V9801
V9801

Reputation: 369

Add row to a table with tablesorter and pager

I'm trying to add a row dynamically to a tablesorter table with a pager. Whenever i do, all other pages get removed. How can i add it? alternatively, how can i remove the oager from a table and return it to its normal state? that would also help. Right now, i am trying to append a row, then i have tried:

    $("table#inventory").trigger("update");
    $("table#inventory").trigger("appendCache");
    $("table#inventory").trigger("sorton", [[0, 0]]);

and

    $("#pager *").unbind('click');
    $("table#inventory").trigger("update");
    $("table#inventory").trigger("appendCache");
    $("table#inventory").trigger("sorton", [sorting]);
    $("table#inventory").tablesorterPager({
        container: $("#pager")
    });

and

$('table#inventory, table#inventory *, #pager, #pager *').unbind();
$("table#inventory").tablesorter({
    debug: false,
    sortList: [[0, 0]]
}) .tablesorterPager({
    container: $("#pager")
});

based on what i have read online at various forums. Thanks in advance.

Upvotes: 2

Views: 1970

Answers (1)

Mottie
Mottie

Reputation: 86413

I have a fork of the tablesorter plugin on my github site. I noticed your question and recently added the ability to add a row to the table while the pager is active. As you stated above, using the "update" method doesn't work because it updates the cache to include only the visible rows.

I've also added a destroy method, if you still need that :)

Here is the demo page.

Upvotes: 3

Related Questions