Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1817

Selecting a row

$
0
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
<script type="text/javascript" charset="utf-8" id="init-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');
        }
    });
} );

</script>    
What's wrong?

Viewing all articles
Browse latest Browse all 1817

Trending Articles