I have a repeating group with a list of objects e.g. “Coffee”, “Milk” etc.
When I click “Coffee” I show a second group, that should contain information about “coffee”.
My first thought was that I need to send data to the group, just like you would if you linked
to a page instead of a group. But that doesn’t seem to be an option for groups. My next guess was that I need to set the group showing information about coffee to have the data source of the current cell (coffee cell), but that doesn’t seem to be an option either.
So then I tried a workflow, when the coffee cell is clicked, it shows the info group and tried Data to display. That only lets me display the current cell’s index. Not the “coffee” item.
Bit tired, so I’m probably missing something pretty obvious here. Please help?
Edit: When I say RG cell is clicked, I mean an object inside the RG cell is being clicked of course.
Hey Casheets, we’re talking about this in another thread where I recommended watching this tutorial. The tutorial isn’t a how-to on solving your specific problem, but it will show you how custom states work.
I’ve used this method in many different apps and it works great. You need to create a custom state criteria, then when you click a Repeating Group Cell, it’ll set the state to that cell’s info. Then your next repeating group, or pop-up or whatever will be the selected state. It’s hard to explain by typing it out, watch the tutorial and let me know if you’re still having trouble.
OP’s question is answered, BUT, for anybody struggling with something similar, here’s another primer, which you may prefer (or not) to the other video pointed to:
Haha, I thoroughly enjoyed your video, Keith. You’re a happy guy!
Sadly, even after your SEO efforts, I think that thread was probably the only thread that didn’t show up when I searched both the forum and google.
So there’s a small difference in our way of going about it I think. You’re creating a custom state
for the selected item and then setting your type of content to the desired Data type and the group’s data source to the custom state?
I’m “telling” the info group to display a certain type of data with the Display Data operator
in the workflow itself and then just set the content type to be the desired data type. I can
then call for the data in the same way, of calling the parent group. I just found this faster and easier to set up since I’m only showing the info in a group acting as a “page”, and not interacting with RG.
I wonder if there are any negatives to doing it this way? I found that the group didn’t reset properly between different RG selections. So I had to add a 100ms delay after the reset. But apart from that it seems to do the trick.
Well types are set in the editor and you can’t dynamically change a group’s type at runtime (Bubble is strongly typed, unlike vanilla JavaScript), so I’m not quite sure what you’re saying.
But it is true that there are many ways to skin this particular cat. You can, instead of grabbing the index of the item on selector click, just grab the item itself and do things that way, for example.
(But note that if you do that, you can never know what the index was in vanilla Bubble as there is no .indexOf() type function. That is, you have the item, but you don’t know where it’s positioned in the list and/or RG. This might be useful to know if you have some other list of corresponding values that you wish to select at the same time… or at some later time. For most applications this isn’t an issue… but…)
The main point of my video is that getting a handle to an item from an RG is trivial and that we need not even think about it. We just do it and move on. But somehow, folks get spun by this.