Change the displayed page after an ajax call

Change the displayed page after an ajax call

hanchhanch Posts: 1Questions: 1Answers: 0

Hi,
I'm using datatables 1.10 using ajax request to get all the data from the server so that paging is done only on the client.
I want to be able to change the default page (on the client), so that for example when I reload ajax the UI will display page 2 initially.
I tried to set displayStart=20 for example to display the 3rd page as the ajax call returns, but it still shows the first page.
I also tried to call the page() function, but couldn't find the right callback to use for that.

Pls advise
Thanks

Answers

  • kthorngrenkthorngren Posts: 21,324Questions: 26Answers: 4,949
    edited January 2022

    I tried to set displayStart=20 for example to display the 3rd page as the ajax call returns, but it still shows the first page.

    The displayStart option works with ajax loaded data:
    http://live.datatables.net/deverima/1/edit

    I also tried to call the page() function, but couldn't find the right callback to use for that.

    The callback to use once the table is initialized is initCompete. Or you can use init.

    Please update the test case to replicate the issue or post a link to your page so we can help debug.

    Kevin

Sign In or Register to comment.