hi i need help with adding pagination to my search results page with some code, right now i have everything working fine i just need an example code to add some pagination to search results. here is the search function code i am using:
function search() {
wixData.query('AgentsBuyer')
.contains('location1', $w("#searchBar").value)
.or(wixData.query('AgentsBuyer').contains('zipCodes', $w("#searchBar").value))
.or(wixData.query('AgentsBuyer').contains('name', $w("#searchBar").value))
.or(wixData.query('AgentsBuyer').contains('location2', $w("#searchBar").value))
.or(wixData.query('AgentsBuyer').contains('location3', $w("#searchBar").value))
.limit(200)
.find()
.then(results1 => {
$w('#repeater1').data = results1.items;
if (results1.length > 0){
$w(‘#noResText’).hide();
} else {
$w(‘#noResText’).show();
}
})
. **catch** ((err) => {
let errorMsg = err;
});
}
thanks for all the help in advance !!!
https://www.wix.com/corvid/reference/$w.Pagination.html
Pagination
An element for working with paging.
A pagination bar provides a way for your users to control the paging of a dataset . Elements that are connected to the same dataset as the pagination bar are affected when the user interacts with the pagination bar.
For example, suppose you have a repeater connected to a dataset and that dataset is set to have a page size of 5. When the page loads, the repeater shows the first 5 items from the dataset. If a user clicks on the next page button of a pagination bar connected to the same dataset as the repeater, the repeater then shows items 6-10 from the dataset.
You can also use a pagination bar without connecting it to a dataset. When doing so, you have to provide the pagination logic that runs when a user interacts with the pagination bar.
Also have a look at Mikhail’s reply in this previous forum post too which will give you an easier way of doing it through the dataset settings.
https://www.wix.com/corvid/forum/community-discussion/how-to-enable-next-previous-page-for-a-repeater-control
To set one up on a page then you can do this simple way.
https://support.wix.com/en/article/adding-and-setting-up-a-pagination-bar
yeah i know how to add a pagination and all that, i just need help with adding it to the filtered results in the repeater when i had a pagination bar on it when i would click next page it would reset the filtered results with just what was in the database, thanks !!!