Can't select some rows

Can't select some rows

rubenmgarrubenmgar Posts: 2Questions: 0Answers: 0
edited March 2012 in General
Hi,

I've got an HTML table (created by PHP), and I'd like to select multiple rows. But something estrange is happening, because I can select first 10 rows but next ones, cannot. It doesn't matter if I see all rows in a page, can't select 11th and so on. My code is

[code]


$(document).ready(function() {

var gaiSelected = [];

var oTable = $('#taula').dataTable( {
"sDom": "<'row'<'span5'l><'span5'f>r>t<'row'<'span5'i><'span5'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ registos por página",
"sSearch" : "Buscar: ",
"sInfo": "Entradas de _START_ a _END_ (Total _TOTAL_)",
"oPaginate" :{
"sFirst": "Primera",
"sLast": "Última",
"sNext": "Siguiente",
"sPrevious": "Anterior"
}
},
"aoColumns": [
{ "bVisible": 0 },
null,
null,
null,
{ "bSortable": false },
{ "bSortable": false }
],
"aaSorting": [[1,'asc']]
} );

$('#form1').click( function () {
alert(gaiSelected);
return false;
} );


$('#taula tr').click( function() {
var aData = oTable.fnGetData( this );
var iId = aData[0];

if ( jQuery.inArray(iId, gaiSelected) == -1 )
{
gaiSelected[gaiSelected.length++] = iId;
}
else
{
gaiSelected = jQuery.grep(gaiSelected, function(value) {
return value != iId;
} );
}

$(this).toggleClass('row_selected');
} );



} );



[/code]

Thanks!
Ruben

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Please see this FAQ: http://datatables.net/faqs#events :-)

    Allan
  • rubenmgarrubenmgar Posts: 2Questions: 0Answers: 0
    Yes!

    Thank you Allan, now it works.

    Ruben
This discussion has been closed.