How do I change the status of a button that is inside a repeting group?

I’m trying to change the status of a button inside an RG from a button outside the RG. Is this possible?

Hi douglas,

Unfortunately, you cannot (easily) reference an element within a RG from anything outside of the repeating group.

There are a couple of ways you can get around this for your use case:

  1. Depending on the Data Type of the RG, you may be able to create a custom state on the entire RG element that is a list of the Things inside the RG (that is initially empty). When the “add button” is clicked, then you can add that Thing to the custom state list, and put a conditional on the button to change the icon, if “current cell’s thing” is in the RG custom state list.

When you press the refresh button, you can then clear out the custom state on the entire RG element. I hope that makes sense, but if not, I can give a step by step breakdown.

  1. Alternatively, you can look in to the plugin Orchestra, which allows you to run workflows inside repeating group cells, from outside the RG.

I think the first approach should work for you.

I understood in part what you said, but I don’t know exactly how to do it, I took the state from the button and passed it to the RG as a list.

And I created this conditional on the button:

image

However, I can’t find a way to add an item to the list at the current row position, the only way I’ve found to add an item is to use the plus item.
image

As you’ve rightly identified, Bubble has very limited list management features, and you cannot insert items in to custom states at certain indices.

To use the approach I outlined above, you need a list of things that are being added in to the custom state that are all unique values, and can uniquely identify that row of data in the RG. That way, you don’t need to worry where they are in the list, just if they are in the list. So specifically, the steps would be as follows:

  1. Create a state on your RG that is a list of values that you know will be unique values of something within each row of data in the RG. This could be a unique text value, a unique ID etc. From your video, it looks like there could be a few potential options for you (maybe the telephone number?).

  2. When the user presses the “add icon”, you just need to use :plusitem to add it to the custom state list. You won’t have to worry about where it is in the list, because each value is unique.

  3. The conditional on the icon (to change it’s icon type) should be a check that the unique value of whatever you are referencing on this cell is in the RG’s list state.

  4. When you press refresh, then clear out the entire state.

Is is possible for you to use some other value, rather than a list of Yes/No’s? Perhaps, something unique about each row?

Btw, this approach probably won’t work if you need to clear data for a specific row from a button outside of the RG. So for example, if you wanted that refresh button to only reset one of the rows, then I think you will find it difficult to remove a specific item from the custom state.

I hope that helps. I’m happy to take a peek at your editor, if you need further help.

1 Like

image
Thanks for your help, I used this check and it worked correctly.

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