Forum Academy Marketplace Showcase Pricing Features

How to hide repeating group if empty

Hello guys, I have a repeating group in my app which I want to hide or collapse height if it doesnt return any results. How can I achieve this?

You can use a conditional statement that if the count of items returned by the repeating group search is zero, hide the repeating group.

2 Likes

that would work yes, but I found a problem which is the fact That I end up with an empty spot. Any way to collapse height?

I may have found out how, I would have to put it inside a group and collapse the group when empty.

1 Like

does not collapse unfortunatly

Collapse group ought to work. I use this feature extensively.

Here’s a quick example:
CloudApp

2 Likes

Hi,

Maybe you can try this.

Put rg in group, set the group collapses when hidden, then set conditional on the group when rg list of … count is 0, this group isn’t visible.

I have tried it out but it does not work. I have seen somewhere that maybe if I have hidden elements on top of that group that may be the reason why it does not collapse.I dont know I really need this to work

If there is an element to the side or on top (in the same vertical space) it won’t collapse that space (just hide the group). Check to see. If so, either redesign to get rid of it, or have it collapse as well.

1 Like

CloudApp

here is an example of a situation that could be causing the issue you are encountering

1 Like

I will give it a try

It does work thanks but I still have on element which I cannot move which is a groupfocus and I am not able to collapse. Any idea how to do that?

I’m sorry, but I’m not familiar with the Group Focus element, as I don’t use it.

I’ve found in these situations it is generally better to redesign things to work around these problems (i.e. can you do without the group focus?), rather than trying to force your way through Bubble’s limitations.

A group focus floats above the page relevant to a particular element. It won’t impact the rest of the elements on the page.

I have literally gone and checked all elements, and even though I managed to collapsed the element there is still a space that does not have any element in there and it is black. Breaking my patience into pieces haha

The solution is to put the repeating group into a group (usually of the same dimensions), and have that “container” group collapse when hidden.

1 Like

While the “wrapper group” solution works most of the time for force-collapsing RG’s, there is actually a Bubble bug for RG’s that in some infrequent cases keeps the RG from collapsing when empty, even when wrapped in a collapsing wrapper-group. It took me forever to figure this out.

If you run a counting conditional ANYWHERE on your page or in the active workflows against the RG, the RG will not collapse when empty. Simple as that. The fix is to change your counting conditional to the form of a :item# is not empty format and then it will collapse when empty. E.g. “if RG:count > 5 do something” is the same as “if RG:item#6 is not empty do something”. I haven’t bother logged a bug on this simply because I don’t have the time to construct a extra-app example page for Bubble analysts to digest.

i was going crazy trying to figure out why my element wasn’t collapsing and THIS was why! thank you so much!

1 Like