当我完成服务器端调用并创建完使用fnCreatedRow
的行后,我希望隐藏一些列。 我想在此回调中为多个列执行列可见性语句,代码如下:
sAjaxSource: url
,
table.fnSetColumnVis(0, false, false);
在datatable中有没有办法实现这样的功能? 我已经尝试使用fnDrawCallback
和fnRowCallback
但它们根本不执行。
以下是我编写的代码。
table = $('#ID').dataTable({
"bServerSide": true,
"bProcessing": true,
"autowidth": true,
//"bInfo": false,
"dom": 'C<"clear">lfrtip',
"scrollY": "350px",
"scrollCollapse": false,
"paging": true,
"scrollX": true,
"destroy":true,
"sAjaxSource": url,
"aoColumns": [
{
"targets": 0,
//"bVisible": true,
"title": "Select Client",
"bSearchable": false,
"bSortable": false,
"width": "10%"
},//Many such entries
],
"fnCreatedRow": function (nRow, aaData, iDataIndex) {
//Function body
},
"drawCallBack" : //Actual code that i want to get executed after fnCreatedRow has ended
});
fn
吗?只用drawCallback
?这段代码放在哪里?如果不是正确的位置,它就不会起作用。 - jonmrich