Is it possible to have the "selected" item "sticky" when using SortbyColumn? For example, I have itemA selected, then I sort the gallery by id. I am hoping to see itemA is still selected, or, at least the 1st item on the new list is selected. Right now, it seems to select a random value after sorting. Thanks.
Hi @NewBee117 ,
The property to control the "sticky" item is TemplateFill for the gallery.
it is normally set to something like If(ThisItem.IsSelected,<Color>,White) meaning it shows the user the last item they selected when they come back to the gallery, which is often on a different screen.
Without seeing your code, it cannot give you a proper answer, but it should be possible if you can refer the other gallery
Lookup(ThisItem.<Identifier>= . . the other gallery.selected.<same id>
Give it a go - happy to help if you get stuck
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks for writing back. There is only one gallery in this exercise. Here are my code.
And here is how the app works:
Stick should keep ItemA selected (blue) regardless which row it is on. Is it possible?
Hi @NewBee117 ,
The reason why you met this problem is that:
Gallery.Selected will change to the first item by default.
So when you change the table's order, the selected item will change together.
However, I've figured out a solution to avoid the order's effect.
I suggest you save the table's data to collection and update the selected item to a certain value. Make the item that has the certain value as "selected item".
I've made a similar test for your reference:
I assume that your original table name is test.
1)save the original table as a collection
set the screen's OnVisible:
//add a column that save the certain value
2)update the collection, update the selected item with certain value (true)
set the arrow button inside the gallery's OnSelect:
set the gallery's Items:
SortByColumns(test1,"....",If(var1,Descending,Ascending)) //replace the field that you want
set the sort button's OnSelect:
3)make the item has certain value as the selected one
set the arrow button's Color:
Then the selected item's arrow button will be red,others will be blue. And this will not change with the order's changing.
I put in your code, and the visual effect looks like it is sticky to the arrow, however, it is not the true selected item after the sort, the item highlighted in blue (TemplateFill) is. Good try though.
ItemA moved to top row with the red arrow and the AddColumn of "selected", however, the third row is the true "selected" in blue.
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.
We are excited to announce that Demo Extravaganza for 2021 has started!
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks