Forum Documentation Showcase Pricing Learn more

Setting State value on Reusable Element in Repeating Group

#1

Hey you super experienced Bubble Users…

I have a repeating group, and inside is a reusable element.

I want to pass two kinds of information into the reusable element.

One is its Data Source.

The Other has to be a State.

How can I pass a different Current Cell’s value to the state of each reusable element in each row of the repeating group?

Thanks in anticipation!
Antony.

#2

Hi @antony,

I hope you don’t mind a question instead of an answer :neutral_face:, but I’m hoping I might learn something as well. I’m curious about your setup, as I thought the purpose of a reusable element was to display exactly the same content in multiple places (typically different pages).

It never occurred to me to use a reusable element inside a RG, since each repeating cell would be unique in some way (which seems to run contrary to the purpose of a reusable element). What’s the advantage of a reusable element in that context?

Sorry if this is Bubble 101, but I’m always interested in new tips and techniques. :slightly_smiling_face:

#3

Hey @shot, thanks for your message. I have an RG which displays data about messages which have been sent, and I need to send it details of which message “function” is involved so the data is displayed in the right way. Trying to avoid an repetition of “code” (well, no code code, elements and actions).
I have an outer RG with the message functions, and an inner RG of the actual messages sent for that function for a given user. So I need to pass in the user and the message function.
Hope that makes sense!
Antony. :slight_smile:

#4

Well, I don’t know if it helps, but I try to think in more “passive” rather than “active” terms when it comes to Bubble - i.e. elements “referencing” or “responding to” data (states) or events as opposed to “passing” or “sending” information.

I’ve also found that creating a “data hierarchy” within the page, where the nesting of groups reflects that hierarchy, can facilitate this approach. For example, the “thing” of the page itself might be a User, with a group or RG referencing that user’s messages, and then elements within the RG referencing their parent.

If structured in such a way, then the nested elements can simply reference the “current cell’s” or “parent group’s” data, and things should be fairly straightforward.

Also, keep in mind that things like an element’s data source and visual attributes can be changed based on a “condition” (via the Conditions tab of the property editor).

Anyway, you probably know this stuff, but having a bit of a traditional coding background, I have to continually remind myself of it. (The Bubble programming model seems to more closely align with front end frameworks like React or Vue.)

#5

I would also like to set the state of a reusable element inside a repeating group.

Identifying the correct reusable element shouldn’t be a problem as I can have an input in the same cell of the repeating group trigger the workflow.

But the workflow doesn’t have the reusable element as an option.

The data source on the reusable element can access data on the page, so I should be able to connect any custom state in the reusable element to data on the page. But I can’t, because none of the custom states show up in the reusable element’s settings.

I can pass one type of data into the reusable element using the data source, but I need two types of data. Is it possible to pass more than one thing into a reusable element inside a repeating group? @emmanuel

1 Like