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
Solved! Go to Solution.
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:
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:
Best regards,
Kris
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:
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:
Best regards,
Kris
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
Where might I log a suggestion for a feature to maintain the selected item on gallery refresh? 🙂
User | Count |
---|---|
156 | |
94 | |
82 | |
77 | |
58 |
User | Count |
---|---|
197 | |
175 | |
103 | |
95 | |
89 |