So I have a gallery with a bunch of items from a sharepoint list. Each item has a checkbox next to it. The point of the gallery is to be able to select a bunch of items and then click "checkout" which will take you to another screen. When you check a box, the item is added to "ShoppingCart" collection, and when you uncheck it, the item is removed from the "ShoppingCart" collection.
The gallery is long and has over 200 items. So I have a search bar and some drop-down filters as well as a sort button that re-sorts it alphabetically or reverse-alphabetically.
I noticed when I check a couple of boxes, then hit the re-sort button twice (so it goes back to the original order), the check boxes disappear. However, the items still appear in my list. When I go to checkout, the items are still there. It's also interesting, because when I check the same items again, the items are duplicated in the list.
The gallery uses a SortByColumns(Filter( as well as an if statement to determine how to display the gallery. The sort button only has the following code:
UpdateContext({SortDescending1: !SortDescending1})
SortDescending1 is just used in the If statement of the gallery to determine if its alphabetical or reverse alphabetical.
The basic problem boils down to this: the boxes uncheck when I re-sort the list. Anyway to fix this so the buttons stay checked when the list is re-sorted?