I created a table with a jQuery plugin for dataTable. I am trying to get the td data of a tr element by clicking on this tr. I read the documentation that says I need to use "fnGetData", but when I try to do this, I get an error message:
TypeError: table.fnGetData is not a function
var data = table.fnGetData (this);
My js code is:
$('#customerTable tbody').on('click','tr', function(){
var data = table.fnGetData( this );
alert(data);
});
My DataTable is initialized as follows, working well without the click event:
var table = $('#customerTable').DataTable( {..});
Do I need to link another script plugin in the html head section?
Sincerely.
source
share