禁用使用jquery数据表的列排序 [英] disable a column sorting using jquery datatables

查看:165
本文介绍了禁用使用jquery数据表的列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery 数据表插件来对表格字段进行排序。我的问题是如何禁用特定列的排序?我尝试使用以下代码,但它没有工作:

I am using the jQuery datatables plugin to sort the table fields. My question is how do I disable sorting for a particular column? I have tried with the following code, but it did not work:

"aoColumns": [
    { "bSearchable": false },
    null
]   

我也尝试过以下代码:

"aoColumnDefs": [
     { "bSearchable": false, "aTargets": [ 1 ] }
 ]

但这仍然没有产生所需的结果。

but this still did not produce the desired results.

推荐答案

这是你要找的:

$('#example').dataTable( {
      "aoColumnDefs": [
          { 'bSortable': false, 'aTargets': [ 1 ] }
       ]
});

这篇关于禁用使用jquery数据表的列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆