禁用数据表中的排序图标不适用于第一列

时间:2018-03-14 08:07:53

标签: php zend-framework datatable

我正在使用"bSortable": false"orderable": false,但仍会在第一列标题中显示asc图标。我尝试了"bsort":false"orderable": false, "targets": "_all",但图标仍然可见。

如果我使用"aaSorting":[],则抛出

  

未定义的变量:orderColumn

mycode的:

var test_table = $('#testDataTable').DataTable({
                // "lengthMenu": [[10, 50, 100,150,200], [10, 50, 100,150,200]],
                "lengthMenu": [[25, 50, 100], [25, 50, 100]],
                "iDisplayLength": 25,
                "sScrollX" : "100%",
                "scrollX" : true,
                "processing" : true,
                "serverSide" : true,
                "destroy":true,

                "ajax" : { 
                            url: "/test/datatable.php", 
                            type: 'POST',
                            data: { status: 'ok' }
                        },
                'columnDefs' : [{"searchable": true, "orderable": false, "targets": '_all' }, {"width": "12%", 'targets': [3,4,5] }]
            });

提前致谢。

1 个答案:

答案 0 :(得分:0)

将您的代码更改为:

对我而言,这一直都有效;)

var test_table = $('#testDataTable').DataTable({
                // "lengthMenu": [[10, 50, 100,150,200], [10, 50, 100,150,200]],
                "lengthMenu": [[25, 50, 100], [25, 50, 100]],
                "iDisplayLength": 25,
                "sScrollX" : "100%",
                "scrollX" : true,
                "processing" : true,
                "serverSide" : true,
                "destroy":true,

                "ajax" : { 
                            url: "/test/datatable.php", 
                            type: 'POST',
                            data: { status: 'ok' }
                        },
                "aoColumnDefs": [{ "bSortable": false, "aTargets": [ "_all" ] }],
                "aaSorting": []
            });