禁用 jQuery DataTables 中特定列的排序 [英] Disable sorting for a particular column in jQuery DataTables

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

问题描述

我正在使用 jQuery DataTables 插件 对表格字段进行排序.我的问题是:如何禁用特定列的排序?我已尝试使用以下代码,但没有奏效:

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 DataTables 中特定列的排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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