I want to hide some columns after my server side call completes for the URL specified in
sAjaxSource: url
,
and after I am done creating rows using fnCreatedRow
. I Want to execute column visibility statements
table.fnSetColumnVis(0, false, false);
for multiple columns in this callback. Is there a way to do this in datatable? I have tried using fnDrawCallback
and fnRowCallback
but they do not execute at all.
The code I have written is as follows.
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
});
Try this:
"drawCallback": function(settings) {
//do whatever
}
https://datatables.net/reference/option/drawCallback
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With