如何获取jquery数据表的“columnDefs”属性?

时间:2016-02-25 18:14:30

标签: jquery datatables

我想让目标在另一个功能上使用:

{
    "targets": [ 4,5,6,7,10,11,14,15 ],
    "visible": false,
    "searchable": false
},

更新

答案:

var table = $('#table').DataTable();
table.init().columnDefs[0].targets;

Got it here. 谢谢你们!

2 个答案:

答案 0 :(得分:0)

在插件函数调用之外创建一个选项对象非常简单....只需将整个对象传递给该插件函数。

adb devices

然后代码中的其他地方:

var tableOpts = {
    "targets": [ 4,5,6,7,10,11,14,15 ],
    "visible": false,
    "searchable": false
};    

$(selector).Datatables( tableOpts );

答案 1 :(得分:0)

答案:

var table = $('#table').DataTable();
table.init().columnDefs[0].targets;

Got it here.

谢谢你们!