fnDrawCallback does not work propertly
fnDrawCallback does not work propertly
didvae
Posts: 6Questions: 0Answers: 0
I'm using multiple selecting rows, when table is loaded, I can select and unselect rows, but if I do pagination or sorting(repaint the page), then I cannot select rows, if I change page again, I can do it. I thought that fnDrawCallback is executed every time table is painted, but seems to be executes ones yes, ones no, once yes, once no ...
I add this to dataTables config:[code]"fnDrawCallback": function() {
$('.dataTable tr').click( function() {
$(this).toggleClass('row_selected');
});
}[/code]
thanks in advance
I add this to dataTables config:[code]"fnDrawCallback": function() {
$('.dataTable tr').click( function() {
$(this).toggleClass('row_selected');
});
}[/code]
thanks in advance
This discussion has been closed.
Replies
There are a number of options - the more obvious I would say is to use a live / delegated event: http://datatables.net/faqs#events .
The other option is to use the $API method:
[code]
oTable.$('tr').click( function () { ... } );
[/code]
the $ function will give you a jQuery object to operate on all TR elements in the table's body.
Allan