最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Datatables ServerSide sort not working. What has gone wrong? - Stack Overflow

programmeradmin1浏览0评论

I'm using datatables with server side processing. Everything works fine, except the sort function. It doesn't show any errors in the console. What could be happening?

$('#example').DataTable({
        "lengthMenu": [[5, 10, 15, 20], [5, 10, 15, 20]],
        'paging': true,
        'info': true,
        'filter': true,
        'stateSave': true,
        'processing': true,
        'serverSide': true,
        'aaSorting': [[2, 'asc']],
        'bSortable': true,
        'bProcessing': true,
});

I'm using datatables with server side processing. Everything works fine, except the sort function. It doesn't show any errors in the console. What could be happening?

$('#example').DataTable({
        "lengthMenu": [[5, 10, 15, 20], [5, 10, 15, 20]],
        'paging': true,
        'info': true,
        'filter': true,
        'stateSave': true,
        'processing': true,
        'serverSide': true,
        'aaSorting': [[2, 'asc']],
        'bSortable': true,
        'bProcessing': true,
});
Share Improve this question edited Aug 2, 2019 at 22:20 DavidHyogo 2,9064 gold badges32 silver badges50 bronze badges asked Mar 17, 2017 at 22:41 Eduardo ChiquitoEduardo Chiquito 451 silver badge9 bronze badges 1
  • What do you use as serverside hanler script? – Behrad Khodayar Commented Mar 17, 2017 at 22:56
Add a ment  | 

1 Answer 1

Reset to default 3

How do you process sorting on the server side? That's what datatables is sending to the server:

order[0][column]:column_number
order[0][dir]:direction(asc|desc)

Column number is 0-based You have to sort the data on the server side.

发布评论

评论列表(0)

  1. 暂无评论