Repeater Links & Buttons (Load Amount, Collapse and Expand)

Hi

I have a repeater set up to display and filter stills and information but i’m struggling with a couple of things.

  1. how to make each button only load a certain number of images.

  2. how to make my load more button disappear when theres no more items left to load. So i can have a load more and load less button to expand or collapse the repeater.

  3. how to make a load less button

  4. I have 4 buttons set up to filter the information in the repeater to display the images & info i want it to. When the button first loads it displays 8 pictures. I have a load more button below the pictures which loads 8 more images each time its clicked. When i select a different category i want it to automatically reset the load amount to 8. So when i click each option it will only display 8 images even if the load more button has expanded the repeater.

See Pic


The code i have used for the repeater buttons is as follows.

// … filter to commercial
export function commercial_click() {
console.log(“filtering items to commercial”);

$w("#datasetfilm").setFilter( wixData.filter().contains('catagory', 'commercial') ); 

}

  1. I would also like to create a way to expand and collapse the repeater. At the moment if you click the button the page becomes longer and longer with no way of resetting it. I would like to either have a load more and load less button or another solution to make this work. If i have 2 buttons i would like them to disappear when theres no more items to expand or collapse similar to how the galleries would work if you want to show more or less images.

I have my load more button connected to my data base, but there doesn’t seem to be an option to load less. see pic


I’ve also tried multiple times to make the load more button show and hide with code but i’ve had no luck.

I’ve been working on this for about 2 weeks now and have tried lots of options based on other posts or on the WIX API lists but i just can’t figure it out. I’ve managed to get everything else on my site working but i’m just going round and round in circles with this part.

If anyone could help, or at least point me the right direction it would be really appreciated.

1 Like

I have the same problem.

Same problem. It seems like a basic operation but cant find any resources on the topic. Ive been trying to just reset the repeater using :

$w(“#dataset1”).setFilter( wixData.filter() );
$w(“#dataset1”).setSort( wixData.sort() );
and
$w(‘#repeater1’).data=[]

…but neither solution addresses the number of items being loaded. This bug causes my browser to crash if you try to search after loading more than 2 pages, so I really hope someone can figure it out.

Note that this post is originally from 2018 and you are much better adding a new post rather than bumping up an old post and referring back to this old post in a link, otherwise the post could be closed.

Since this is the post that comes up when you google for the problem I think it would make sense to not close it until theres an answer but ill repost it