[SOLVED] How to show/hide multiple groups one after the next?

Hi…

Can anyone suggest the best way to achieve this;

I have 4 colored groups with a ‘+’ and ‘-’ icon. Clicking the minus icon should hide the bottom (red) group. Then, clicking it again should hide the next (blue) group. The ‘plus’ icon should reintroduce the hidden groups back in the same order.

Screenshot 2022-09-29 145014

I know I will need to store this in a custom state and perhaps in the DB too because a user’s group settings will need to be saved. The tricky part is how to enable multiple add/remove events to trigger from a single icon. Help appreciated.

If you only ever have 4 groups, then you could just assign each group a number (as its DataSource, or in a custom state), then simply use a condition to show/hide the group based on whether its number is less than or equal to another number which would be set by clicking the plus or minus icons…

If the number of groups is more dynamic, then use a RG with basically the same method (you’ll need to think of some way to define the colours for each group)…

1 Like

Thanks @adamhholmes - The CSS you gave me has been fantastic, the rows and columns are now working great (ignore bright colours, that’s just to make it easier for me to see whist developing!)

Ok, I see what you mean about assigning each group a number, I will try that thank you.

There will only be 4 rows, however I will have 6 columns (each with 4 rows). What you see below is one column with 4 colours which should have a condition to show/hide.

Oh, I just tried to assign a number to the data source but it wants to reference the height or width?

No, just type the number into the data source directly (i.e. type “4”) - it looks like you’re selecting the Group ‘4’ rather than just typing the number 4…

Obviously, the content type needs to be set to Number…

Here’s a simple demo:

Add/Remove Group (bubbleapps.io)

3 Likes

Thank you! That really helps … :slight_smile:

1 Like

That was such an elegant and perfect solution @adamhholmes - I am able to continue on my window app now, it’s coming together :slight_smile:

2 Likes

Tomorrow I will add a second column with numbers for rows 5, 6, 7, 8. Thinking about this, I would like both columns to behave independently, so a user can retain all 4 rows in column 1 (doesn’t hide any), but they may want to hide some of the rows in column 2. I don’t know if this is possible but will find out tomorrow?

Also, do you know how to add notes to the HTML? I tried adding forward slashes like; //notes// but that didn’t work.

Simple… just treat the 2 columns completely separately… like this: Add/Remove Group (bubbleapps.io)

Also, do you know how to add notes to the HTML? I tried adding forward slashes like; //notes// but that didn’t work.

You mean comments? Like this?.. HTML Comments (w3schools.com)

That’s it! Although I think the link to your editor points to the old page as I can’t see how you achieved this?

You mean comments? Like this?.. HTML Comments (w3schools.com)

Thank you, that’s what I needed.

That’s it! Although I think the link to your editor points to the old page as I can’t see how you achieved this?

Oops… it’s fixed now: Add/Remove Group (bubbleapps.io)

1 Like

Thank you!

Unfortunately I think Bubble has some restrictions because if I use <!-- Write your comments here --> then any HTML directly after this is ignored, see my example here Loom | Free Screen & Video Recording Software | Loom. This isn’t super important so no worries if this is a Bubble issue, I will have to avoid using comments.

@adamhholmes Without wanting to take advantage of your generosity, I wondered if you could check out the video below because I’d like a ‘sanity check’ to make sure I am approaching the problem in the best way. Maybe my approach with the add/remove rows is not the smartest way to do what I need?

Ultimately I need the user to be able to generate something like this, each window height can be adjusted but it always respects the overall frame height.

I suppose a nice solution would be …

You can’t use HTML comments in CSS…

For CSS comments you need to use /* type comments here */

CSS Comments (w3schools.com)

Ok thanks @adamhholmes