Selecting a row
Selecting a row
DiegoTc
Posts: 10Questions: 0Answers: 0
Hi
I will like to selec one row of my table, I got the idea of the example of the selecting example, but it doesn't work.
This is my code
[code]
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "tomacorrienteslist.jsp",
"bFilter": false,
"bSort": false,
"bInfo": false,
"bPaginate": false,
"aaSorting": [[ 4, "desc" ]],
"aoColumns": [
{ "mData": "codigo" },
{ "mData": "descripcion" },
{ "mData": "xbee_id" }
]
} );
$("#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]
What's wrong?
I will like to selec one row of my table, I got the idea of the example of the selecting example, but it doesn't work.
This is my code
[code]
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "tomacorrienteslist.jsp",
"bFilter": false,
"bSort": false,
"bInfo": false,
"bPaginate": false,
"aaSorting": [[ 4, "desc" ]],
"aoColumns": [
{ "mData": "codigo" },
{ "mData": "descripcion" },
{ "mData": "xbee_id" }
]
} );
$("#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]
What's wrong?
This discussion has been closed.
Replies
"oTableTools": {
"sRowSelect": "multi",
"sSwfPath": "/swf/copy_csv_xls_pdf.swf",
},