Select a column not working
Select a column not working
Hello
In the example I found a code to get the column data if clicked on
http://datatables.net/reference/type/column-selector
Get the data for a column that was clicked on:
I tried the code but I always have the error "TypeError: table.columns is not a function"
What is wrong?
table = $('#projectdata').dataTable( {
columnDefs: [
{ visible: false, targets: 1 }
]
} );
$('#projectdata tbody').on( 'click', 'td', function () {
var columnData = table.columns( $(this).index()+':visIdx' ).data();
alert(columnData);
} );
regards
hawk
Answers
You need to capitalize the the 'd' of your
dataTable()
call:And here is why, from the api reference page: