cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aabrin
Advocate II
Advocate II

Bug: Gallery with calculated values will lose Selected index when calculated value changes

Description:
If you create a gallery that includes a calculation of underlying values, then change any of those underlying values, the gallery's Selected item will reset to being the first item in the list.

 

Repro steps:
1) Create TableA_Gallery with an item list from TableA, with Items = AddColumns('TableA', "CalculatedColumn", Sum(LookUp('TableB', TableA_ID = 'TableA'[@ID], NumericValue)))

2)  Create a form (TableB_Form) for editing an item from TableB that is included in the calculations in TableA_Gallery

3)  Select any item in TableA_Gallery other than the first one

4)  Edit the NumericValue field in any row in TableB that is included in the calculations of TableA_Gallery

5)  SubmitForm(TableB_Form)

6) TableA_Gallery Selected item will now be the first item in the list, NOT the item selected in Step 3

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @aabrin,

Based on the Repro steps that you provided, I have made a test, and the issue is confirmed on my side. But I don't think it is a bug.

When you modify NumericValue value in any record of your TableB data source, the TableB data source would be updated. So the result the AddColumns formula returned would also be updated, that means your Gallery control would also be refreshed. In default, the first item of the Gallery control would be selected.

 

If you want to not change the selected item within the Gallery control when you modify the NumericValue field in any row in your TableB data source, please take a try with the following workaround:5.JPG

 

6.JPG

Set the OnSelect property of the Gallery control or the Navigate icon ( ">") button within the Gallery control to following formula:

Set(CurrentSelectItem,ThisItem)

Set the Default property of the Gallery control to following formula:

CurrentSelectItem

Set the TemplateFill property of the Gallery control to following:

If(ThisItem.ID=CurrentSelectItem.ID,RGBA( 255, 105, 180, 1 ),RGBA(0, 0, 0, 0))

The GIF screenshot as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @aabrin,

Based on the Repro steps that you provided, I have made a test, and the issue is confirmed on my side. But I don't think it is a bug.

When you modify NumericValue value in any record of your TableB data source, the TableB data source would be updated. So the result the AddColumns formula returned would also be updated, that means your Gallery control would also be refreshed. In default, the first item of the Gallery control would be selected.

 

If you want to not change the selected item within the Gallery control when you modify the NumericValue field in any row in your TableB data source, please take a try with the following workaround:5.JPG

 

6.JPG

Set the OnSelect property of the Gallery control or the Navigate icon ( ">") button within the Gallery control to following formula:

Set(CurrentSelectItem,ThisItem)

Set the Default property of the Gallery control to following formula:

CurrentSelectItem

Set the TemplateFill property of the Gallery control to following:

If(ThisItem.ID=CurrentSelectItem.ID,RGBA( 255, 105, 180, 1 ),RGBA(0, 0, 0, 0))

The GIF screenshot as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

That does fix the issue, but don't you think it's still a workaround more than the way this is designed to work?  I understand that it's refreshing the original gallery, but don't you think the expected behavior should be to maintain the selected item after refresh in this circumstance?

Hi @aabrin,

The result the AddColumns formula returned within the Items property of the Gallery would be refreshed when you change NumericValue field in any row in TableB.

 

In other words, the Gallery control would be refreshed when you change NumericValue field in any row in TableB, so the selected item would not be maintained.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Where might I log a suggestion for a feature to maintain the selected item on gallery refresh? 🙂

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,365)