Search code examples
javascriptjquerytablesorter

How can I restore the current page after an operation with jQuery Tablesorter?


I'm working with tablesorter and I've not been able to find any documentation about the plugin tablesorter pager. The thing is that I have a table that displays some data and in each row there is a delete link that has attached to it the unique identifier of the element that it's going to be deleted (obviously).

Is it possible to save the page in which I'm at the moment of deleting, and then set the pager straight to the page it was before? It is because when I reload the table after deleting the row, it goes back to the first page.

What I want to do is something like this:

//Before deleting 
var page = //Here is what I'm asking for, a way to get the page that is on now
var rowsPerPage = //A way to obtain the size option of the pager
//Delete row

//Refresh table and then a way to set the 
///page where I was again.
     $("#TST").tablesorter(...)
                 .tablesorterPager({
                     container: $("#TSTPager"),
                     positionFixed: false,
                     size: 5
                 });

Thank you very much, Victor


Solution

  • If you click on the tablesorter tag, you will find several other developers wrestling with this type of problem, such as Need Help with Jquery TableSorter Pager plugin.

    In an answer there, and replies to other similar questions, a suggestion is made to use DataTables.net instead.

    Yes, it's frustrating to think of changing tools at this point, but the level of frustration with your paging problem, and the favorable opinions about the other tool, suggest that you might be able to get this problem solved more quickly, and get your project back on track, by changing tools.