Using select a row for more than one Datatable a page?
Using select a row for more than one Datatable a page?
triplethreat77
Posts: 4Questions: 4Answers: 0
I am able to select a row within my datatable, but I have more than one table with different options, and the example here https://datatables.net/release-datatables/examples/api/select_single_row.html will only work with one. Each table works independently, and I can't seem to manipulate this to work for me. I also posted help on Stack Overflow, with no response so far. http://stackoverflow.com/questions/18851323/select-a-row-on-datatables-allowed-on-more-than-one-table-a-page
This discussion has been closed.
Replies
I am not 100% sure but I feel like you can manipulate:
[code]
$("#example tbody tr").click( function( e ) {
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
[/code]
the #example refers to the table id, so I am assuming creating another jquery function like this one but change #example to the tables names that you have. Hopefully this helps.
Also oTable is the variable name he set up, you obviously need to change oTable to the 2 different variable names that you have for your tables.