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 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.
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.