Accessing datatableData inside fnDrawCallback
Accessing datatableData inside fnDrawCallback
soroushhakami
Posts: 10Questions: 0Answers: 0
[code]$(document).ready( function() {
var oTable = $('#example').dataTable( {
"fnDrawCallback": function() {
var data = oTable.fnGetData();
}
} );
} )[/code]
This gives me a 'can't call fnGetData on undefined'.
As I understood it, this is the purpose of fnDrawCallback, to be able to manipulate the created DOM, but clearly I misunderstood things. The API is quite brief on this ( " This function is called on every 'draw' event, and allows you to dynamically modify any aspect you want about the created DOM. " ). What I'm looking for is something equivalent of a callback-function I guess. Could anyone give me some clues on how to be able to solve this problem?
Thanks in advance
var oTable = $('#example').dataTable( {
"fnDrawCallback": function() {
var data = oTable.fnGetData();
}
} );
} )[/code]
This gives me a 'can't call fnGetData on undefined'.
As I understood it, this is the purpose of fnDrawCallback, to be able to manipulate the created DOM, but clearly I misunderstood things. The API is quite brief on this ( " This function is called on every 'draw' event, and allows you to dynamically modify any aspect you want about the created DOM. " ). What I'm looking for is something equivalent of a callback-function I guess. Could anyone give me some clues on how to be able to solve this problem?
Thanks in advance
This discussion has been closed.
Replies
[code]
$(document).ready( function() {
var oTable = $('#example').dataTable( {
"fnDrawCallback": function() {
var data = this.fnGetData();
}
} );
} )
[/code]
Allan