chris
chris

Reputation: 36947

jQuery Datatables stop sort on tfoot elements

I've been looking over the API's and searching there forums, but I can't find anything as of yet. Right now what I have is a standard table

<table>
   <thead>
     <tr><td></td><td></td><td></td><td></td></tr>
   </thead>
   <tbody>
     <tr><td></td><td></td><td></td><td></td></tr>
     <tr><td></td><td></td><td></td><td></td></tr>
     <tr><td></td><td></td><td></td><td></td></tr>
   </tbody>
   <tfoot>
     <tr><td></td><td></td><td></td><td></td></tr>
   </tfoot>
</table>

quick hand typed rendition. Anyway.. when I click on the elements in the thead to have it sort, the stuff in the tfoot sorts with the stuff in the tbody. In a sense negating the needs I'd want to have a tfoot for.

So my overall question is, is there a way to exclude the tfoot from being included in the sort?

datatable settings:

 $('#'+tableID).dataTable(
                {
                    "sPaginationType": "full_numbers",
                    "bPaginate": false,
                    "bFilter": false,
                    "bAutoWidth": true,
                    "sScrollY": tableY+"px",
                    "bScrollCollapse": true,
                    "oLanguage": {
                        "sInfo": "Showing _END_ Events."
                    },
                    "aaSorting": [[ 1, "asc" ]],
                    "aoColumns": [
                         null,
                         null,
                         null,
                         null
                       ]
                });

Upvotes: 0

Views: 4096

Answers (1)

mg1075
mg1075

Reputation: 18155

The standard examples from the website for DataTables don't have the problem you describe; i.e., the footer isn't part of the sorting.

I've attempted to fork one of the examples and use (most) of the code you offered as a sample, with only a few modifications. The footer is not part of the sorting.

http://live.datatables.net/uyanul/edit#javascript,html,live

Maybe there is a piece of code causing this issue that wasn't part of your original question?

Upvotes: 1

Related Questions