Repeating group number of rows

Hello,

I’m trying to put a link at the bottom of my repeating group, to display more informations.
I start with 5 rows and if this link is clicked i want to dusplay more rows.

I’(d like to set a condition so that if the number of items retrieved from the db is lower than the number of rows of my repeating group, then ther’s no need to display this link.

I was able to get the number of rows retrieved from the db but I don’t know how to get the number of rows of my repeating group dynamically…

Anyone could help me please ?

You can use an external plugin to retrieve the count of rows and keep the indexes saved. Pagination for Search Results

You mean I can’t get or set the number of rows of the repeating group without a plugin ?

You can. You would make the repeating group “fixed” for the type (say 5 rows).

But the plugin helps count the number of pages you would have in the repeating group

Yes I know i can set the number of rows while designing.
But I need to change it dynamically.
Is it possible ?

Anyone here to help me ?
I would just like to know how I can retrieve the number of rows dynamically ?
I tried to set a new custom state like numberOfRows but it seems I can’t set this variable as the number of rows in the widget properties… In other words, I wonder if it’s possible to retrieve this information dynamically, as it seems impossible to dynamically set it.

Any Bubble expert here to confirm ?

supposing your repeating group has the ID “myRG”, you can run a small javascript code in a “Run javascript” workflow action from the plugin Toolbox. The following code counts the number of actual rows in the repeating group and return the count to Bubble through a “Javascript to Bubble” element, again, available with the plugin Toolbox:

var count = document.querySelectorAll('#myRG > .rows > .group-item').length;
bubble_fn_rowCount(count);

The “Javascript to Bubble” element’s suffix needs to match with the code (in this case “rowCount”) and publish a value of type number.

Then you can access the row count within Bubble with the Js 2 Bubble element.

If the number of rows changes, you need to find a way to run the code again to update the count.

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