Add "items" to repeats for available bindings

Wappler already has a few bindings that are auto available on client side repeat elements, such as $index, $key, $value
I would love to see items added there too, like they are for an Array component

Without items it is currently not possible through data bindings to do certain things such as using sum() outside the repeat, while manually adding {{repeat1.items.sum(`price`)}} works perfectly by manually adding it.
It is also not possible to show the values like {{repeat1.items.values(`price`)}} which is great when i want a comma separated list of values in the repeat.

Yep, this certainly would of helped someone recently

2 Likes

Not sure what are you trying to achieve Paul, but you can select server connect > query > open formatters > collections > sum > column and it will add the sum on your page.
It generates code like:

{{serverconnect1.data.query1.sum(`my_column`)}}

Same goes for data store, array component and data view component …

1 Like

Thanks Teo, that is my normal way of doing it by getting the data directly from the server action itself, however there are some unique cases where it is preferable getting the data returned from the client side repeater element.

I know it sounds strange, but when dealing with APIs which often have quotas attached to their calls, I would rather do all my filtering of the full API returned data completely client side and not pass filters back to the server action to re-query the API and return the data.
By doing this client side I am saving almost 30 API calls per session on average, which has already saved my client a fair amount of money this month on their API license.

Just to reiterate, I am already using it this way and it is working well, so it’s not like I am currently stuck with a problem, just wanted to see if we could get this added in the GUI.

You can bind the server connect query data 10 times on your page and filter it clientside - the call will be only one if your server action is only one.

1 Like