Reset repeater size after using .loadMore

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 a load less button
    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.

Ive tried to implement:
(" #dataset1 “).setPageSize(6)
(” #dataset 1").setFilter( wixData.filter() ) -with- (" #dataset 1").setSort( wixData.sort() );
and (’ #repeater 1’).data=
But the repeater still tries to load in hundreds of things at once if the repeater is changed after .loadMore() is called

The closest solution I’ve found is using:
wixLocation.to(wixLocation.url) to simply refresh the page, but due to code in my site tab, this ruins my sites functionality.

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

Does it make any difference if you took out the setPageSize code for your dataset and set that in the dataset’s own settings within the Wix Editor and also adding just 8 to the load more button total too?
https://support.wix.com/en/article/adding-and-setting-up-a-dataset

Also, you don’t mention where your buttons for filtering actually are, if they are outside or within your repeater.

See this example here for repeaters and using inline actions (inside repeater) and global actions (outside repeater), as you might need to add the code for each button too if you can’t set it up through the dataset settings itself and the buttons are outside.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-input-repeaters

Like what is setup in this example from Vorbly with buttons for filtering a repeater.
https://www.vorbly.com/Vorbly-Code/WIX-REPEATER-WITH-FILTER-BUTTONS

I can control how many items are loaded per page in the dataset, and these methods are being called on my repeater. But they’re only reseting the values of the fields for the 100’s of items now loaded onto the page, and it crashes trying to populate them. The buttons are outside the repeater, on the page.

I believe a workaround may be possible even if this feature doesnt exist: redirect the user to a new page , which imports the query currently in the search bar and loads the first page of those results. Then allow the user to change the search bar and only load one page.
But i think this would be a terrible UX so i really hope theres a cleaner solution

Hi!! I found a solution (after many MANY tries):

export async function button31_click ( event ) {
await $w ( “#dataset8” ). loadPage ( 1 );
}

This wil reload de page 1 in the repeater!