microsoft / powercat-creator-kit

This toolkit helps create well-designed Power App experiences on the web & mobile. It contains a component library; PCF controls and other utilities that increase developer productivity.
MIT License
318 stars 53 forks source link

[BUG]: DetailList Selected Property Getting Reset #388

Open sperry1625 opened 1 year ago

sperry1625 commented 1 year ago

Describe the bug I have an application that has a Command Bar, Navigation Control and a DetailList.

Selecting an item from the Nav on the left filters the items that show in the DetailList. The Edit and Activate command items in the Command Bar are only enabled if there is an item selected in the DetailList. I use the following for the ItemEnabled property for the DetailList Items: !IsBlank( detlstItems.Selected ). That has always worked. What is happening is when I select the Activate command it makes some updates, including changing some properties in the underlying collection for the DetailList. The result is, even though a record is still selected, the detlstItems.Selected property is now Blank(). You can see in the below image, the item is still selected but the two CommandBar menu items are disabled. Why is the detlstItems.Selected property getting cleared?

To Reproduce Steps to reproduce the behavior:

  1. Create app as show above
  2. Add code to one of the CommandBar buttons that makes changes to the underlying collection for the DetailList.

Expected behavior If there is a selected record in the collection the Selected property for the Detail List should not be Blank().

Screenshots image

Additional context N/A

AB#947

sperry1625 commented 1 year ago

I still believe the above is a bug and the Selected property should not be cleared, but...

I fixed this issue by creating an InputEvent, $"SetFocusOnRowSetSelection{Text(Rand())}", for the Detail List so it reselects the record that was previously selected.