Help with repeater and "selected" state

Hi, I need the help of the great minds of this forum: I’ve built a dropdown that includes an inner search (that’s why I did not use the default dropdown widget), for showing the list of items I used a repeater. Everything works nicely except for the part where I select an item and when I open the list again, I want it to be selected (and the former selected item should be unselected).

Any guidance or suggestion for accomplishing this would be highly appreciated. :slight_smile:

Here’s the link to what I have achieved so far:
I’m also attaching here the .rp file: Country selector.rp (129.2 KB)

Most likely, you’ve used “Set selected to This” in the Click or Tap of the repeater item, and created a Selection Group so that only one can be selected at a time. That works fine if you don’t need to change the repeater. However, when you change a repeater–with Update Rows, Add Rows, Sort, Filter, etc. it triggers the Item Loaded event for the repeater, so all the rows get loaded again, with their default states, including the selection state–which would be defined by the selection group (as the most recently selected.)

If this is the situation, what you’ll need to do is create a column to track which item(s) are selected, and a conditional case in Item Loaded to set the current row/item to selected if [[Item.MyColumn]] equals "true". Then, in the Click or Tap event, instead of “Set Selected to This” you’d want at least two actions:

Update Rows set MyColumn to “false” where [[item.MyColumn == ‘true’]]
Update Rows set MyColumn to “true” for This

…If this doesn’t make sense, and/or I find enough time, I can check out your .rp file with this suggested solution.

Hi @mbc66,

Thanks for taking the time to give this a thought :slight_smile:
I solved the issue eventually by using a variable that holds the selected country and every click on an item in the repeater will update the variable to that country. I made a mistake in the way I checked which country was selected which made me think the solution was not working, once I fixed it everything works like a charm.