Set page on table component

Hi, i was trying to set the page a table shows on load, but cant seem to make it work.

The intention is that User A does w/e in its table and then can share that state through the url with User B, then User B clicks the link and the app loads with the settings, every setting other than the page is set correctly.

I tried using a JS on page load with table.setPage(url.searchParams.page), but still loads the table with currentPage : 0.

Any ideas as to why this is happening or if there is a solution at all?

Thank you!

Have you tried adding a delay on your JS?

I'm wondering if the JS fires before any data is loaded into the table so technically there is no page X to switch to on the table yet.

1 Like

Yes, it works with a delay.

Now im wondering if this is the only way to set a page on load, to me it feels kinda ugly that there isn't a currentPage field in pagination to set depending on a variable or url parameter.

Untested, but you could try the following:
Build a dummy 'query JSON with SQL' that triggers on load or update of the table data.
Then when the table finally loads it's data it triggers the dummy query to set the page.

In my example I've also set a flag so that it disables the query so as to not change the page number while the user interacts with the table and triggers the data to refresh again.