Selecting One Repeating Group Cell at a Time

I’m trying to set up a repeating group that uses custom states to select each individual cell but only one at a time. Currently, when you select the Selected Cell group within the repeating group, it changes red to show that cell has been selected. What I want is for only one cell to be selected at a time. I figure there must be a way to change the custom state value of all the other Selected Cell groups within the repeating group but I can’t seem to figure that out. Any help would be appreciated.

Try it out:

I made a couple of tweaks. Is that what you are looking for?

I made a slightly different suggestion (maybe I interpreted @max.black761 question differently).

First I created a state on the page (I always find it easier to keep all states on the top element, the page).

Then I created a new icon (just to keep things separated from @SerPounce suggestion’s). In that icon I created this workflow that sets the parent group to the state we just created.

I tweaked it a bit with some conditionals and added a workflow to clear the state if I clicked on the same Storyline.

To give feedback to the user, I change the icon to something else to show that it is selected and, if clicked, it will deselect.

1 Like

Fair call. Rereading the OP it seems your approach solves the need since only one RG cell is to be selected.

Also, I totally agree that is best practice to keep all states at the page. However, in the interpretation where multiple cells can be selected, the custom state would need to be within a group within the RG.

Y’all are awesome. That’s just what I was looking for. I’d seen a couple of posts seeming to ask for the same thing but they never had any replies. @SerPounce @rico.trevisan

1 Like

Just store the index of the selected cell. Your condition for highlighting the cell is when the selected index is current cell’s index.

1 Like

Would it work in this case where he’s also using draggable groups?

By the way, @max.black761, if you wanna level up your RG game, @keith is your man, List Shifter is your tool.

This is great @keith. Very simple solution and works perfectly. What would I do to de-select the group when I click it again?

@rico.trevisan As you say this can get kind of wonky with the draggable groups since the selected cell remains but the content moves. For my purposes now, it’s not an issue but for anyone else not using draggable groups, it wouldn’t be an issue at all.

Thanks again so much for the help.

Hey Max. Just null out the selected index value (if the clicked group’s index is the same as selected index). In Bubble we do this by setting its value to empty (you literally leave the field empty as shown below):

You’ll note that if you think about the logic of this, you’ll of course need two workflows – one to set the state and one null the state out when we need to. In Bubble this is like so - here’s what we want to do when Selected Index and Cell’s Index are different (this is what you’re already doing, basically):


And this is what we want to do when Selected Index and Cell’s Index are the same:


3 Likes

Awesome! Thank you Keith!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.