reload page and save pagination status with active SearcPane filter not possible

reload page and save pagination status with active SearcPane filter not possible

themwthemw Posts: 4Questions: 1Answers: 0

Link to test case: https://jsfiddle.net/themw/hdwk42yo/
Description of problem: Hello everyone,
First of all, I use version 1.1.0 of SearchPanes.The reason for this is that since version 1.1.1 the pagination is not saved when the page is refreshed (no matter if a filter is active or not). I could almost solve this problem with version 1.1.0. However, there is still the problem that if I use a filter and refresh the page, the pagination is not saved. Only if no filter is selected, the current page (pagination state) is saved. Does anyone know how to fix this problem?

This question has accepted answers - jump to:

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @themw ,

    Thanks for pointing this out, it should indeed be saving the paging. I've raised an issue internally (DD-1685 for my reference) and will report back here when there is an update.

    Thanks,
    Sandy

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

    This has now been addressed, and we're hoping to release this in the next week with SearchPanes 1.2.1.

    Colin

  • themwthemw Posts: 4Questions: 1Answers: 0
    edited October 2020

    @colin
    I am now using version 1.2.1 and the previous problem no longer exists. A big thank you for your effort.
    But there is now another problem. For example, if I am on page two and reload the table using :

    table.api().ajax.reload( null, false );

    I always return to page one. It does not matter whether filters of SearchPanes are active or not. It seems that reloading with ajax.reload resets the pagination.

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    table.api().ajax.reload( null, false );

    This works here:
    http://live.datatables.net/puwuvuyo/1/edit

    Please provide a link to your page or a test case showing the issue so we can help debug. You can update my example.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • themwthemw Posts: 4Questions: 1Answers: 0
    edited October 2020

    Unfortunately I cannot reproduce the bug using JSBin or JSFiddle because it is very difficult to reproduce it.

    If I enter the following

    table.api().ajax.reload( null, false );

    the state save of the pagination is possible until I insert

    dataTables.searchPanes.min.js
    and
    searchPanes.bootstrap4.min.js

    and then set the SearchPane option, such as

    var table = $('#example').DataTable({
    searchPanes: {
    viewTotal: true,
    controls: false,
    columns: [3]
    },
    });

    I think that SearchPanes overwrites the storage of the pegination state when it is initialized.

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    I built a test case for you based on your code snippets:
    http://live.datatables.net/puwuvuyo/8/edit

    The the case does replicate the issue. @sandy or @colin will need to take a look.

    Kevin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @themw @kthorngren ,

    Thanks for working through this to come up with an example. I'd agree with you that that is not the correct behaviour. I've raised an issue internally (DD-1702 for my reference) and will report back here later in the week with an update.

    Thanks,
    Sandy

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @themw ,

    That should be the issue fixed now. SearchPanes was running it's filter after the ajax reload had set the paging, which reset it. Now SearchPanes will take into account the paging set by the ajax reload.

    Thanks,
    Sandy

  • themwthemw Posts: 4Questions: 1Answers: 0

    Hello,

    i could solve the problem now, because i have implemented a live plugin. With this plugin the pagination is not reset.

    However, when I use the command table.api().ajax.reload( null, false ); the pagination is still reset. You haven't released a new version, so how should the porbem be fixed?

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @themw

    You can access the fix by pulling in the SearchPanes code from the nightly builds. I've modified the example above to show how to do this, and you can see it is working there.

    Thanks,
    Sandy

  • DanyVit90DanyVit90 Posts: 9Questions: 3Answers: 0

    Perfect, it works!

    Really thanks!

This discussion has been closed.