powercat-creator-kit icon indicating copy to clipboard operation
powercat-creator-kit copied to clipboard

[BUG]: DetailsList Selected property not blanked when removing selected record

Open e-gallis opened this issue 2 years ago • 5 comments

Describe the bug After removing a selected record from the list's records, the Selected property still holds the data of the deleted record.

To Reproduce Steps to reproduce the behavior:

  1. Add a DetailsList control to the screen
  2. Provide the control with a set of records through a collection
  3. Add a button on the screen with a piece of code to remove the selected record from the collection
  4. The record is removed from the list but the Selected property still holds the deleted record

Expected behavior The Selected property should be cleared if the currently selected record is removed from the list (that is, when no records are selected)

Screenshots N/A

Additional context N/A

AB#2489

e-gallis avatar Mar 06 '24 20:03 e-gallis

Anyone with any idea on how to workaround this issue meanwhile?

e-gallis avatar Mar 06 '24 20:03 e-gallis

@e-gallis would it work to update the collection to 'reset' after deletion by selecting the first item in the list instead of clearing out? Have you tried that scenario, or would there be any reason why that is inappropriate for your workflow?

denise-msft avatar Jun 18 '24 05:06 denise-msft

Hi @denise-msft, Indeed this would be inappropriate. Here is my scenario:

  • I have a DetailsList component listing a set of records from a collection
  • The application allows me to delete a selected record
  • After the record has been removed from the collection there should be no more record selected -> therefore I expect the Selected property to be blank You can find the same behavior on Microsoft Lists: deleting an item does not select the first item in the list after deletion. There is just no other item selected. I expect the same from the DetailsList component. Well, I suppose it is a "standard behavior" throughout web applications in general. Hope this helps... 😉

e-gallis avatar Jun 18 '24 07:06 e-gallis

@e-gallis we are unable to reproduce this issue. Is this issue still happening for you in the latest version of the Creator Kit?

Can you please provide the code you're using to remove the record? Also, are you binding directly to a table or using a local collection? And are you implementing the set row selection capability at all, or is this just a basic Remove() operation?

If you bind the detailsList directly to the table (e.g., Dataverse Accounts table) and use a button to remove the selected record (e.g., Remove(Accounts, FluentDetailsList1.Selected);) then this should work as expected/what you described.

denise-msft avatar Aug 30 '24 01:08 denise-msft