//This example will add a button in datatable toolbar. You can add any html element. You can find code here.
Advertisements
//This example will add a button in datatable toolbar. You can add any html element. You can find code here.
in my case, I replaced this table.columns().search().draw(); with table.api().columns().search().draw();
added .api() and it solved my problem.
need to add these two files
http://cdn.datatables.net/fixedheader/2.1.1/css/dataTables.fixedHeader.css http://cdn.datatables.net/fixedheader/2.1.1/js/dataTables.fixedHeader.min.js
and this
var table = jQuery('#datatable').dataTable({}); new $.fn.dataTable.FixedHeader( table, { // alwaysCloneTop: true // "zTop": "2001" "offsetTop": 50 });
You can check more options here.
"aaSorting": [ [2,'asc'], [0,'desc'] ],
Datatable API provides easiest way to do it.
"sDom": 'Rlfrtip', "oColReorder": { "aiOrder": [8,7,2,3,4,5,6,0,1] },
You can add any column order you want.