Hi,
Is there a way to count the items of a repeater and transform it into text. I do not work with filters, so it should be quite easy I think. I am just not very good with code, so that’s why I ask you
Thanks already!
Hi,
Is there a way to count the items of a repeater and transform it into text. I do not work with filters, so it should be quite easy I think. I am just not very good with code, so that’s why I ask you
Thanks already!
$w("#text1").text = $w("#repeater1").data.length.toString();
and of course, put it inside $w.onReady(), and dataset.onReady() if needed.
Sorry,
I am really bad in code… How would it look like if I paste it completly?
Thanks!
I tried it but the text remains the same. It doesn’t show the number of items of the repeater
As I mentioned, you should put it inside $w.onReady():
https://www.wix.com/corvid/reference/$w.html#onReady
and inside datast.onReady():
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#onReady
But I don’t know how that works… Can’t you make it for me? Sorry I am still a learner on wix corvid.
That’s why I put here links and references so you’ll be able to see examples.
This forum is to provide you with help and support for your code issues as you have asked the exact same question here.
https://www.wix.com/corvid/forum/community-discussion/couting-the-items-of-a-repeater
if you are wanting somebody to do all your code for you so that you can simply copy and paste it, then have a look at using Wix Arena.
https://www.wix.com/arena/web-designers/1
“I am really bad in code.”
Well simply just asking for others to do it all for you so that you are just copying and pasting is not going to get you learning anything, use the info and the links that J.D. posted to teach yourself and learn how to code a little better.
Sorry but I dont understand the $w.on.Ready
I don’t know how to use it
Have a good read of this section here.
https://support.wix.com/en/corvid-by-wix/basics
But why can’t you give the full code?
Because I already have the main part
$w("#text1").text = $w("#repeater1").data.length.toString();
I just don’t know how to transform it into a solid code. Because know it doesn’t work at my site
and if you don’t want to count the repeater items explicitly, but to count the items from the dataset that feeds the repeater, you can use:
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#getTotalCount
(You have there an example re how to use it with the onReady functions.
$w.onReady( function () {
$w(“#text103”).text = $w(“#repeater2”).data.length.toString();
});
Is this good?
Hi,
It’s a bit better, but know it says there is just 1 item. But there are 8 whats is the problemen, you think?
Yes. But add dataset.onReady too.
Like this? … it doens;t work
I am trying
$w.onReady( function () {
$w(“#dynamicDataset”).onReady( () => {
$w(“#text103”).text = $w(“#repeater2”).data.length.toString();
});
Yes. But you’re missing }) at the end;