How to Table sorter in node page? I have a table in node page. i have requirement to make it sort-able on click.

can anyone help?
I used something like this in one of my installations:

// create a table of nodes of a specific content type
function MYMODULE_create_table($node_type) {
  // setup headers
  $headers = array(
     array('data' =&gt; 'Nid'),
     array('data' =&gt; 'Title', 'field' =&gt; 'title'),
     array('data' =&gt; 'Status')
  );
  // build query
  $query = db_select('node', 'n')-&gt;extend('PagerDefault');
  $query-&gt;limit(30);
  $query-&gt;fields('n', array('nid', 'title', 'status'));
  $query-&gt;condition('n.type', $node_type, '=');
  // make it sortable
  $query = $query-&gt;extend('TableSort')-&gt;orderByHeader($headers);
  // execute query
  $result = $query-&gt;execute();
  $rows = array();
  foreach($result as $node) {
    $rows[] = array(
       $node-&gt;nid,
       $node-&gt;title,
       $node-&gt;status
    );
  }
  // add a pager if needed
  if(count($rows) &amp;&amp; ($pager = theme('pager'))) {
    $rows[] = array(
      array(
    'data' =&gt; $pager,
    'colspan' =&gt; 3,
  )
    );
  }
  // return html for table
  return theme('table',
            array(
                'header' =&gt; $headers,
                'rows'=&gt;$rows,
                'empty' =&gt; 'No products found...',
            )
    );
}


The above perhaps work just as is, but it might give you some clue on how this can be done.

TableSort