Hello Bubble community,
I am currently working on an article writing app, which creates several sections (H2) and subsections (H3) for an article.
So I made a repeating group (H3s) inside another repeating group (H2s). For a user to delete an entire section (H2) it’s easy : I just have to put the delete button in an H2 cell, and then delete the corresponding H2 in the workflow.
But how can I delete an H3 section ? I can have the index of my H3 but I can’t find a way to get the corresponding H2’s index.
To make it simple, if I want to delete the 3rd H3 of the 4rth H2 section, how can i do it dynamically?
Thanks a lot.
(I have another topic on this project about how to insert an element in a specific position in a list)
Put a group inside the cell and make that group’s type “number”, then make the data source “Current cell’s index”. Then to reference the cell’s index from a layer deeper just reference the group’s number instead.
EDIT: I might have skimmed through your post I can read more later if no one else has answers
If you are open to plugins, you can try looking at Communicator SuperStack.
The ‘sender’ can send information from within a RG to something outside of that RG. Not sure if it will work inside multiple RG’s, but it might.
Hey @tylerboodman, thanks for your answer, but I can’t make it “number”, in need to have it “H3 Section” because I need to access information in it (title, text…)
Thank you @doug4, I will take a look at this.
EDIT : It looks like they can’t help me, I found this note on their plugin page : The “Receiver” cannot be placed inside a repeating group (but the “Sender” can!).
So the answer is :
To take it a step further, when embedding a repeating group in bubble, any workflow actions generated in that line would only reference that line’s group. You’d be pretty safe with something like:
This repeating groups items:filtered (position > current cell’s position) position -1
delete thing: current cell’s H3
That said, what would probably be more stable (and give you a bit more page-wide control) would be creating a list of H3s field on your H2s, then likewise a field for the parent H2 on your H3s.
So when an H3 is created, all you’d need to do is reference the parent group’s thing (assuming you’ve got a parent group and have its type set to H2) in order to populate your parent field, applying the reverse simultaneously in adding it to the parent’s list of H3s.
Now when deleting, you’d be able to use search constraints as opposed to filtering, which is quite generally a lot faster and could be done from an element outside your repeating groups.