Rotate between Pages

Hi All,

I have an App been used to display data to my team without the need for user input. However, this contains a table with a list of items that cuts off screen. My plan is to use pagination and have it rotate between the pages automatically. E..g, Page 1 > Page 2 > Page 1, etc.

I've done some looking into it and found a JS Query that seems to work on the editor mode but doesn't work using the public link. This is what the query looks like (found on another topic on this forum):

let maxPage = Math.ceil(table1.data.length / table1.pagination.pageSize);

let nextPage = table1.pagination.currentPage+1;

nextPage = (nextPage<maxPage) ? nextPage : 0;

table1.setPage(nextPage);

With this query, I've set it to run periodically every 10000ms. This works as mentioned on Editor but if I use the public link, this doesn't seem to run. Is there a way to make it work / is it something I've done wrong?

All I've done is created it as a JS Query, entered that code and set it to run periodically.

Thanks in advance!

Hello @JamieB!

So your code block looks good, the issue seems to be how you trigger the code to run to modify the page being shown on the table.

One option would be to have the query run on page load, which you can do in the query options by setting it to 'Automatic'

Then below this option in the 'Success' Event Handler, you can set the query to run again. To set how much time between query runs, you would use the 'Debounce' input to give it the amount of milliseconds to wait.

Let me know if this works! I am curious how you currently have the query set up which runs in the editor but not in the live app :thinking:

My other suggestion would be to use a Workflow to trigger the page change query and scheduling it with the CRON job. Hope this helps!