how to fetch columns visible stat on preInit event
how to fetch columns visible stat on preInit event
my javascript
var table=$('#sls_app_list').DataTable({
ajax: {
url: "_ajax.php",
data:function( d ) {
d.oper= "init";
d.year= $("#year").val();
},
error:handleAjaxError
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{"data": null, "title": ""}, //1
{"data": "ID", "title": ""},
{"data": "NAME", "title": "NAME_TITLE"},
{"data": "ID2", "title": "ID2_TITLE"}
],
"columnDefs": [ {
"targets": [0,1,2],
"visible": false,
"searchable": false
}]
});
i wish get data information on preInit event ,like this:
if(column[sel].visible){
console.log(column[sel].data);//ex : sel=4 then data is ID2
}
how can i do it?
Answers
The
column().visible()
method can be used to determine if a column is visible or not.Allan