user3344027
user3344027

Reputation: 1

Tablesorter pager plugin - ajax with child rows

The need is to present data pulled from the server using ajax, in a paginated fashion (see http://mottie.github.io/tablesorter/docs/example-pager-ajax.html). Those data are made of "main rows" and of child rows (for each "main row", there is a child row) (see http://mottie.github.io/tablesorter/docs/example-child-rows.html).

Since the ajax data that must be presented to tablesorter is in JSON format, how should I specify that some rows are child rows?

Upvotes: 0

Views: 571

Answers (1)

Mottie
Mottie

Reputation: 86423

You can store the data within the JSON as HTML markup, e.g.

{
    "rows" : [
        "<tr><td>r0c0</td><td>r0c1</td></tr>",
        "<tr class='tablesorter-childRow'><td>r1c0</td><td>r1c1</td></tr>",
        "<tr><td>r2c0</td><td>r2c1</td></tr>",
        "<tr class='tablesorter-childRow'><td>r3c0</td><td>r3c1</td></tr>"
    ]
}

Then just set up the ajaxProcessing function to work with this data.

Upvotes: 1

Related Questions