jquery - Fixed top row when sort in datatable -
i'm building website storing files , here ui
when sort, ".." row bottom row , it's undesirable effects.
i've tried this solution seem likes used old api.
can show me how fix it?
in advance
update here code initialize datatable
var tablefolder = $('#tablefolder').datatable({ columndefs: [ {"width": "50%", "targets": 0}, {"width": "25%", "targets": 1}, {"width": "25%", "targets": 2} ], aasorting: [], deferrender: true, scrolly: 560, scrollcollapse: true, scroller: true, paging: false, info: false, searching: false, ajax: url, fncreatedrow: function (nrow, adata, idataindex) { $(nrow).attr('id', adata[3]); } });
this has answer @ datatables blog.
add plugin page
//cdn.datatables.net/plug-ins/1.10.16/sorting/absolute.js
if want order datatable , keep rows text 'unknown' in first column @ top of datatable.
var nametype = $.fn.datatable.absoluteorder( 'unknown' ); $('#mytable').datatable( { columndefs: [ { targets: 0, type: nametype } ] } );