Unbable to sort the columns

老子叫甜甜 提交于 2020-01-06 07:03:42

问题


I am using jQuery DataTables.

searchResultsTable = $("#searchResultsTable").dataTable({
    "bServerSide": true,
    "sAjaxSource": "searchResults.form",
    "bProcessing": false,       
    "sPaginationType": "full_numbers",
    "oLanguage": {"sEmptyTable": "No data available", "sLengthMenu" :" _MENU_ items per page",
    "sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
    "sInfoEmpty": "No entries to show"},
    "sDom": 'tlip',
    "aaSorting": [],
    "aoColumns": [null,null,null,null,{ "bVisible": false }]
});

I have provided the aaSorting, so that the data gets sorted when user clicks on the header. But it's not working. Am I missing something?


回答1:


CAUSE

You have server-side processing mode enabled with "bServerSide": true. In this mode, data processing including sorting, filtering and ordering should be performed on the server and the returned data need to have certain structure. See Processing modes for more information.

SOLUTION

If you are not performing data processing on the server, simply remove "bServerSide": true and DataTables will perform sorting, filtering and ordering on the client-side.



来源:https://stackoverflow.com/questions/32201482/unbable-to-sort-the-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!