Search code examples
jquerycsstablesorter

how to disable one header among of multiple headers in jQuery table sorter


I've used this table sorter plugin. Now, I've to use multiple headers inside the <thead>. I want only one row stay active for sorting. Without that row, I want other rows of header being disabled for sorting. How can I make this? Here is my fiddle Is there any way disabling one header by css class like this?

<thead> 
<tr> 
    <th class="sorter-false">Info</th> 
    <th class="sorter-false">Info</th> 
    <th class="sorter-false">Info</th> 
    <th class="sorter-false" colspan="2">Text</th> 
</tr> 
<tr> 
    <th>Last Name</th> 
    <th>First Name</th> 
    <th>Email</th> 
    <th>Due</th> 
    <th>Web Site</th> 
</tr> 
</thead>

Solution

  • You can add a parameter to your table sorter plugin:

     $("#myTable").tablesorter({
        theme: 'blue',
        selectorHeaders: '.sorter-true'
    });
    

    Fiddle example: http://jsfiddle.net/lparcerisa/dcwrh9Lx/1/