Pagination fix for repeater

Hi. I am having issues with setting up pagination for my wix repeater. This is the code I am using.

$w(“#html1”).expand()
$w(“#html2”).expand()

$w("#customers").onItemReady(($item, itemData) => {

$item("#text450").text = itemData.customerName;
$item("#text451").text = itemData.serviceProvider;
$item("#text453").text = itemData.services;
$item("#text455").text = itemData.servicePlan;
$item("#text457").text = itemData.orderStatus;


});



wixData.query("WL2X9Customers") // Database ID

.descending("_createdDate")
.limit(4)
.find()
.then((results) => {
$w("#customers").data = results.items; // Repeater ID)	


}); }

I need to use that pagination bar, link it with my wix collection and be able to navigate through the data in my collection.

1 Like

You can use the .next() and .prev() functions on your query’s results to do pagination.

1 Like

Can you show me how would the code need to be written to utilize the next function, also will I need to setup a different button with on click function to link it with next() function instead of the pagination bar.

It would be a bit of code to write and should likely also involve the Datasets API as opposed to the raw data queries.

However after giving this a second look it seems as if everything here could be done in the editor with a Dataset and Dynamic Pages without any code. Here’s some links which should be helpful: