Saurabh
Saurabh

Reputation: 799

tablesorter pager - ajax pagination with checkboxes and custom html cells?

Is there any example out there that explains how to dynamically generate a tablesorter with the pager plugin using AJAX, with checkboxes and editable cells? Currently, all of the examples have hard-coded table data, i.e. <theader> and <tbody> are pre-defined. I can get a basic example up and running with AJAX calls to fetch paginated data, but need to integrate checkboxes into the table.

Also, is it possible to group rows (and expand collapse them) using this plugin? Here's a screenshot of what I'm trying to accomplish:

Much thanks in advance !

AJAX loaded table with checkboxes and grouping

Upvotes: 0

Views: 587

Answers (1)

Mottie
Mottie

Reputation: 86463

The included parser-input-select.js parser file allows for dynamically added and updated inputs, checkboxes & select boxes. All you need to do is set the parser for that particular column:

Place this in the header

<script src="../js/parsers/parser-input-select.js"></script>

and include this code:

$(function(){

  $("table").tablesorter({
    theme : 'blue',
    headers: {
      0: { sorter: 'checkbox' },
      1: { sorter: 'inputs' }
    }
  });

});

This parser will also work with the pager addon. There isn't a demo of this parser being used with the pager, but you can see it working in the grouping rows widget demo.

Upvotes: 1

Related Questions