user2486535
user2486535

Reputation: 428

Avoid sort on last row in the table DataTable plugin

var oTable = $('#table').dataTable({
                "sScrollX": "100%",
                "sScrollXInner": "150%",
                "bScrollCollapse": true,
                "bPaginate": false,
                "bFilter": false,
                "bSortable": true          
            });
            new FixedColumns(oTable, {
                "iLeftColumns": 1,
                "iRightColumns": 1
            });

I am using data table plugin, And my initialize code is as above, i want my last row not column not to be sorted, when i click on any header. I searched every where I couldn't find a way to stop row sorting...Please help me out..............

Upvotes: 6

Views: 6973

Answers (3)

Sheik Sena Reddy
Sheik Sena Reddy

Reputation: 118

Add Footer To The Table .... It Wont Sort The Last Column

<tfoot>
   <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td><b>TOTAL</b></td>
      <td id="billedAmount"></td>
      <td id="totalOtherCharges"></td>
      <td id="totalCost"></td>
   </tr>
</tfoot>

Upvotes: 4

William
William

Reputation: 749

Placing lat row in 'tfoot' tags will sort you out just fine. Worked for me

Upvotes: 0

Rishi Jagati
Rishi Jagati

Reputation: 626

The HTML needs to have a specific setup with thead and tbody tags. So theoretically I could put my last row into a tfoot tag and it wouldn't be affected by sorting.

hope this will work for you.

http://blog.adrianlawley.com/tablesorter-jquery-how-to-exclude-rows/

Upvotes: 10

Related Questions