Código
var oTable; var giRedraw = false; $(document).ready(function() { oTable=$('#example').dataTable( {"bProcessing": true, "sPaginationType": "full_numbers", "sAjaxSource": "pag_aux/dataTable/BAbiertas.ivm"} ); /* Add a click handler to the rows - this could be used as a callback */ $("#example tbody").click(function(event) { $(oTable.fnSettings().aoData).each(function (){ $(this.nTr).removeClass('row_selected'); }); $(event.target.parentNode).addClass('row_selected' ); }); /*Submit*/ $('#TablaForm').submit( function() { var anSelected = fnGetSelected( oTable ); alert(anSelected[0]); return false;} ); } ); /* Get the rows which are currently selected */ function fnGetSelected( oTableLocal ) { var aReturn = new Array(); var aTrs = oTableLocal.fnGetNodes(); for ( var i=0 ; i<aTrs.length ; i++ ) { if ( $(aTrs).hasClass('row_selected') ) { aReturn.push( aTrs ); } } return aReturn; }
Código