Prevent fnRowCallback when manually calling draw on a datatable
Prevent fnRowCallback when manually calling draw on a datatable
jm89
Posts: 1Questions: 1Answers: 0
Is it possible to prevent fnRowCallback being triggered when manually calling draw on the datatable?
I want to still have the fnRowCallback triggered by the draw that happens after paging or search.
I've looked for a way of differentiating between a draw that gets called manually by my code and the draw that get's triggered by the datatable from paging and searching, but can't seem to find anything, is it possible to differentiate the different calls to draw?
This discussion has been closed.
Answers
I would probably set up a global boolean variable. Set it to true if you manually draw the table. In the rowCallback if false then execute the rowCallback. At the end of rowCallback set it to false for the next draw triggered by Datatables.
Kevin
Hi @jm89,
You could try something like this - where you set a variable just before you do the draw - and the
draw
checks for it before running.Hope that helps,
Cheers,
Colin