Collapse empty rows in a RG

I have a RG, which is set to show five fixed number of rows. I have another item below the RG. If the RG finds less than five rows, I would like the RG to show just those without the empty rows below it and collapse the empty rows so that the item below it moves up. How may I do that?

I tried putting all items in the cell in a group and then making it invisible (in conditions) if it is empty, but am unable to invoke the collapse function. I created this inside group by collecting all items in the cell and then creating a fixed group. I don’t see the option to collapse for this group.

This should work
Also check whether your Repeating Group has a minimum cell height or min height set

1 Like

Hi, not clear what you are suggesting? May I ask you to elaborate?

Is the process I have written out ok? It does not work, so it is missing something.

Can you just uncheck the “fixed number of rows” so it only shows the number of items instead of being fixed at 5? After your data source you can do :items until #5 to show only a max of 5 items.

1 Like

Yes of course.

When you add a Repeating Group to your app, it usually comes in with some predefined properties. This usually includes a fixed height and width as well as a min width and min height for each cell.

In case your RG and the groups in each cell are collapsable and your conditions for hiding/showing them are correct, it might be this min width / min height of each cell that causes the cell to not collapse.

I’d also double-check the hide/show conditionals on the groups within each cell to make sure they’re all hiding/showing correctly and are not visible on page load.


Cheers,
Ranjit from Atomic Fusion

Explore and reuse the community’s Bubble assets & Accelerate your Bubble development with Atomic Fusion

1 Like

I would approach the problem a bit differently.
First let me make sure I understand what you want to achieve. As I understand it. You have a repeating group and want it to only be tall enough to show the available data. So if there are three items it’s only 3 rows high but if there are five it should be five rows high.
If that is correct here’s how I would do it.

I’d create a repeating group with 1 predefined row and set the RG to show all items.
Within that group I’d add a regular group just beneath it and set that groups setting to “Collapse if Empty” this will make the row expand or collapse depending on the content.

I’ve found that setting more than one row in a repeating group will make it always keep space for every row, whereas if you just set one it can show as many as needed.

Here’s the group settings
Screenshot 2022-10-18 at 6.31.26 am

Here’s the repeating group settings
Screenshot 2022-10-18 at 6.31.11 am

If this was helpful feel free to buy me a coffee and let me know if you need more help!

3 Likes

Thank you so much. I am anxious to try it out later today.

Thank you, yes that did it. I had zero for minimum height for the row. I removed the zero leaving the field blank, and now it works as it ought. Thanks.

1 Like

Tried that and it works. So thankful.

1 Like

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