row select doesn't work with fnAddData
row select doesn't work with fnAddData
I am very glad to use DataTables.
I have troubles.
I am using example http://datatables.net/examples/api/select_row.html.
It works fine for rows created statically by html page.
I also create rows by $('#example').dataTable().fnAddData().
For this rows doesn't work function:
[code]
$('#example tr').click( function() {
if ( $(this).hasClass('row_selected') )
$(this).removeClass('row_selected');
else
$(this).addClass('row_selected');
} );
[/code]
$('#example tr').click( function() works only for rows created statically by html.
Is it feature or bug?
I have troubles.
I am using example http://datatables.net/examples/api/select_row.html.
It works fine for rows created statically by html page.
I also create rows by $('#example').dataTable().fnAddData().
For this rows doesn't work function:
[code]
$('#example tr').click( function() {
if ( $(this).hasClass('row_selected') )
$(this).removeClass('row_selected');
else
$(this).addClass('row_selected');
} );
[/code]
$('#example tr').click( function() works only for rows created statically by html.
Is it feature or bug?
This discussion has been closed.
Replies
Allan
This works:
[code]
$('#example tr').live('click', function() {
if ( $(this).hasClass('row_selected') )
$(this).removeClass('row_selected');
else
$(this).addClass('row_selected');
}
[/code]
I make little bit donation for you. Thanks.