I thought that hasNextPage() returns only false if it is the last page in the dataset. I receive on all 4 pages false :(
I have a dynamicDataset with 4 entries in it (see image below).
On page with the Dynamic Page Dataset the mode is: Read & Write.
On this page I run the following code:
$w.onReady(function () { $w('#dynamicDataset').onReady(()=>{ let hasNextpage = $w("#dynamicDataset").hasNextPage(); console.log(hasNextpage); }); //if user likes or dislikes, move to the next page of the dynamicDataset $w("#Like, #Dislike").onClick(()=>{ $w("#dynamicDataset").getNextDynamicPage() .then((next)=> {
if(next){ wixLocation.to(next); } }); }); }); Does anybody know why console.log(hasNextPage) is always false?
Hey there!
I made a solution for you that works. Here is the solution:
https://wixshow.wixanswers.com/en/article/check-if-there-is-a-next-item-on-a-dynamic-page
Hey there!
When you are on a Dynamic Page the Dataset you use has only one record so that is why you will get false. Then you should have used hasNext() which will check for next item, hasNextPage() will check for next page of a item using a Dynamic Dataset but this does not work. But you can not use this on Dynamic Page or on Datasets with only one record.
If you use console.log($w("#dynamicDataset").getTotalCount()); you will get 1 as the results so there is only one record. You can use the Next and Previous buttons though I think.