cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
aabrin
Level: Powered On

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
Community Support Team
Community Support Team

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

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
Community Support Team
Community Support Team

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

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

aabrin
Level: Powered On

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

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?

Community Support Team
Community Support Team

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

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.
aabrin
Level: Powered On

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

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,219)