can't select a column
can't select a column
I create a dataTable from a json source :
var table = $('#example').dataTable({
"data": source,
"columns": columns,
"columnDefs": defs
});
It is well displayed but when I try to select dynamically a column as i saw in doc ( http://datatables.net/reference/api/column().visible() )
var col1 = table.column("1");
It launchs an error: Uncaught TypeError: undefined is not a functionWord:678 refreshTabWord:502 (anonymous function)jquery-2.1.3.js:3094 jQuery.Callbacks.firejquery-2.1.3.js:3206 jQuery.Callbacks.self.fireWithjquery-2.1.3.js:3412 jQuery.extend.readyjquery-2.1.3.js:3428 completed
Do you have an idea about what happens and how to fix it?
Answers
Read the example again. You are not calling the visible() method.
Thaks for answere but I had tried differents ways:
=>table.column("0").visible(false);
=>table.column(0).visible(false);
=>var isVisible = table.column(0).visible() === true ? 'visible' : 'not visible'
=> var data = table.columns([0, 1]).data();
and it does not work as in example
Just for checking if problem was my source I have tried with another javascript source as in example : http://www.datatables.net/examples/data_sources/js_array.html and it fails too
Finally It doesn't work with that because I am using dataTable rather than DataTable