How to re-initialise data-sort on jQuery DataTables?

后端 未结 1 834
予麋鹿
予麋鹿 2021-01-07 10:25

I am using jQuery Datatables in my project and I have made \"custom value\" sorting available on a column by using the attribute data-sort as described here: ht

相关标签:
1条回答
  • 2021-01-07 11:07

    You need to invalidate() the cell(s). dataTables have no chance to know that you programmatically have changed orthogonal data (=the custom sort values) for one or more cells in a column. If you have an instance like

    var table = $('#example').DataTable();
    

    and change data-order by

    $('td#myColumnId').attr('data-order', newValue);
    

    then invalidate the cell / column by

    table.cells("#myColumnId").invalidate();
    
    0 讨论(0)
提交回复
热议问题