绘制数据表后,我会禁用对用户的订单可能性。 我有一个数据表,我会订购数据并消除用户手动订购数据的可能性。 我该怎么做?
我使用了下面的代码:
table = $('#tbl-1').DataTable({
"info": false,
"searching": true,
"paging": false,
"iDisplayLength": 25,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Tutti"]],
"language": {"url": "include/it_IT.txt"},
"order": [[1,"desc"]],
//"ordering": false,
//"orderFixed": {"pre": [ 1, "desc" ]},
"fnInitComplete": function(oSettings, json) {
//alert( 'DataTables has finished its initialisation.' );
this.fnFilter("<?php echo $_POST['search'];?>");
},
}).on('init.dt', function (e, settings, data) {
wrappa(); //after custom function
});
最佳答案
旧帖子,但仍未被 dt api 处理。如果想暂时禁用排序,删除事件将不起作用。而是使用 jquery 在每个 th 上添加和稍后删除一个类,并在此类中指定“pointer-events:none”。
关于javascript - 在数据表中初始化(初始化完成)后禁用排序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27544270/