Cannot get Select Row example to work
Cannot get Select Row example to work
I'm attempting to replicate the "Select row example" (see http://datatables.net/release-datatables/examples/api/select_row.html) in my own program. The code I'm using the initialize my table is as follows:
[code]$(document).ready(function() {
var table_obj = $("#my_table");
$('#my_table tr').click( function() {
$(this).toggleClass('row_selected');
} );
table_obj.dataTable({
"oLanguage": {
"sSearch": "Refine results:"
},
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "/transactions_ajax/"
});
} );[/code]
My code doesn't work as expected. Clicking on a row doesn't toggle the select like it does in the example.
The only difference I can see between my code and the example is that I'm using server side processing while the example uses an inline HTML table. But I don't think that is the source of my problem?
[code]$(document).ready(function() {
var table_obj = $("#my_table");
$('#my_table tr').click( function() {
$(this).toggleClass('row_selected');
} );
table_obj.dataTable({
"oLanguage": {
"sSearch": "Refine results:"
},
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "/transactions_ajax/"
});
} );[/code]
My code doesn't work as expected. Clicking on a row doesn't toggle the select like it does in the example.
The only difference I can see between my code and the example is that I'm using server side processing while the example uses an inline HTML table. But I don't think that is the source of my problem?
This discussion has been closed.
Replies