Hello, how do I configure a pagination bar with my dataset? So can I change dynamic pages between one and another. I have already confugure it like its shown in Wix Help Center (Its connected to the database and everthing), but it doesn’t even react. I would like to know witch code to use in the pagination bar.
This should help:
https://www.wix.com/corvid/reference/$w.Pagination.html
I followed the process and it still doesn’t work. The pagination bar works but it skips pages and it doesn’t show the number of pages.
Here is the code:
import wixLocation from 'wix-location';
export function dynamicDataset_ready()
{
$w.onReady(function () {
let isEnabled = $w("#pagination2").enabled; true
let isGlobal = $w("#pagination2").global; true
let isVisible = $w("#pagination2").isVisible; true
$w("#pagination2").currentPage = 1;
$w("#pagination2").totalPages = 4;
});
$w("#pagination2").enable();
}
export function pagination2_click(event) {
$w("#dynamicDataset").getNextDynamicPage()
.then( (next) => {
if(next){
wixLocation.to(next);
}
} );
$w("#dynamicDataset").getPreviousDynamicPage()
.then( (prev) => {
if(prev){
wixLocation.to(prev);
}
} );
}
I don’t know if I need to add or remove something.
(The Pagnation Bar is configured and connected to the database).
As per my understanding, wixlocation.to takes url as an input while prev and next are results set.
What is the possible solution?
There is a Wix tutorial here that will help you for prev and next buttons on a dynamic page.
https://support.wix.com/en/article/corvid-tutorial-creating-previous-and-next-buttons-for-a-dynamic-item-page-with-code
When you want to add previous and next buttons to a dynamic page, you may be tempted to add two buttons, connect them to your page’s dataset, and choose Previous and Next from the Actions list as you would on a regular page. Doing so will not work.
To understand why it doesn’t work, we need to understand a little bit about how dynamic item pages work. A dynamic item page decides which item to display using the dynamic sections of the URL that was used to reach the page. When the page loads, the proper item is then fetched from the database and is accessible to the page through the page’s dynamic dataset. Since it is an item page, there will only be one item in the dataset. Therefore, there are no “previous” or “next” items to navigate to using the Previous and Next actions of the dataset.
This article will demonstrate how you can use code to create previous and next buttons for a dynamic item page. We will do so by adding code to two pages. First, in an index page that your users use to reach your dynamic item pages, we will add code to store all the relevant item page links. Then, in the dynamic item page, we will add code to retrieve the links and use them in previous and next buttons that we will add to the page.
In this article we assume that you are using an index page to present multiple items from one of your collections on a single page. Users select one of the items on your index page to reach the relevant dynamic item page. The order of the previous and next items on your item page will be determined by the index page that the user came from.
Note:
You can also use the getPreviousDynamicPage( ) and getNextDynamicPage( ) functions or the Previous dynamic page and Next dynamic page dataset actions to create previous and next buttons on a dynamic item page. However, you cannot control the item order when using these functions.
As for your code, you only need the one onReady page function and all your lets can just be stacked underneath each other, so let enabled1, let enabled2 and so on.
Plus your dataset onReady function should be written something like as shown here.
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#onReady
$w.onReady( () => {
$w("#myDataset").onReady( () => {
Also, please don’t duplicate your posts for the same issue.
This other post has been closed.
There is also this tutorial that you can look at too for a dynamic slideshow.
Ok thanks.