How to stop automatic page jumping to page 1 ?

How to stop automatic page jumping to page 1 ?

Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

HI, When I am at any page other than 1 after few seconds it is jumping back to page 1 again
exactly to which file i need to make the change.

This question has accepted answers - jump to:

Answers

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    Please tell anyone urgently

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi Aditya14,

    That's definitely not expected behaviour, so your code must be doing some kind of refresh on the table. If you give a live example we can take a look.

    Cheers,

    Colin

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    Hi, Collin can i share the code in jquery.DataTable.js ?

    Actually whenever i am on any page other than 1 it is taking me back to page 1 in 10-15 secs

    I tried to make bstateSave : true but it didnt worked ?

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    I am completly new to this where to make change i dont know

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    The best place to share the code for a live example is here: http://live.datatables.net/

    saveState is for when you reload the page, the table returns to its previous state.

    It sounds like you may be doing additional initialisations. If you could paste the code or get an example running, that would help to pinpoint the problem.

    Cheers,

    Colin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    My guess is that you are either reloading the data in the table periodically (perhaps ajax.reload()) or your are re-initialising the table. Either way, as Colin says, we need a test case showing the issue.

    Allan

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    I am taking data from db dynamically still i tried to place the code http://live.datatables.net/jotexemo/1/edit plz check

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    I am using .net with it

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    This section here:

                            // Aditya - Commenting the page reload functionality on pagination. 
                            setInterval(function () { 
                                dt.ajax.reload();
                            }, 10000);
    

    is saying to reload the table after 10 seconds... Soooo, I'm guessing this will be the culprit! ;)

    C

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28
    Answer ✓

    You are using setInterval to call dt.ajax.reload() which by default resets the paging.
    Using the second example on ajax.reload you should be able to use dt.ajax.reload(null, false) to retain the page

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    Thanks it worked ... can we change css of it ?

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    I need this type of pagination can i ?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    You would need to write that feature (using the page() method). A slider for paging is not something DataTables currently provides.

    Allan

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    @allan ... through any other jquery plugin i can use that functionality

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    As I say, I think you'd need to write the code for that using the page() method. page.info() will give you the information you need for the end limit of the range.

    Allan

This discussion has been closed.