Collapsible group inside of an RG - need to toggle one at a time

Hi all, would really appreciate some help with this.

I’m trying to individually toggle an expandible/collapsible group inside of an RG.

Imagine 6 FAQ buttons that can each expand to reveal a full answer. I’m starting with a custom state list of 6 yes/no’s which are initialized to no, no, no, no, no, no. I’m trying to only toggle the item if it’s at the current cell’s index, but the conditional logic isn’t working out for me.

Basically, if I’m only trying to toggle the 3rd yes/no, it would be something like:

  • Get the no’s up till #3 (leave them unchanged)
  • For the 3rd “no,” add “is no,” which evaluates to “yes” (because no is no = yes)
  • Combine with the rest of the no’s up till 6.

I just can’t seem to wrap my head around the expressions for this no matter how much I try, would really appreciate some help with this, thanks!

A) Set one state to RG : Open Cell (number type)
B) On click of a “title”, set state open cell = current cell number
C) On the collapsible group, set not visible by default and add condition: Open cell state = Current cell number (is visble = yes)

1 Like

Is this what you are looking for?

Editor: testApp42wCleanDB | Bubble Editor
Preview: https://testapp42wcleandb.bubbleapps.io/version-test/faq?debug_mode=true

Hope that helps! :blush:

3 Likes

Hey @Jici @J805 thanks so much for your help on this. I had already been able to replicate this functionality by using something similar to a hybrid of your solutions, (using a custom state with the number of the cell that resets to 0 conditionally).

What I’m trying to do is to have the collapsible not hide when opening another collapsible. Meaning I can open 1, 2, or 3 without it automatically closing when opening another group. They should all be able to independently expand/collapse. This is what I haven’t been able to do.

Any ideas? Really appreciate you guys spending the time to assist with this.

Ok. :+1: So then a simple way would be to use the ‘toggle’ workflow action. Then just choose the element you want to ‘toggle’. Would that solve your issue? No need for states. :blush:

2 Likes

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