【问题标题】:Datatables ServerSide sort not working. What has gone wrong?数据表服务器端排序不起作用。出了什么问题?
【发布时间】:2017-03-17 22:41:54
【问题描述】:

我正在使用带有服务器端处理的数据表。一切正常,除了排序功能。它不会在控制台中显示任何错误。会发生什么?

$('#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,
});

【问题讨论】:

  • 你用什么作为服务器端的hanler脚本?

标签: javascript php jquery datatables


【解决方案1】:

您如何在服务器端处理排序? 这就是数据表发送到服务器的内容:

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

列号从 0 开始 您必须在服务器端对数据进行排序。

【讨论】:

  • 谢谢!现在我明白了,但是我怎样才能获得那个值?...有些像 $search = $this->input->post('search')['value'];
  • 这取决于您使用的后端。对于 symfony 中的控制器,我这样做 - $this->get('order');
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-29
  • 2014-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多