Server side multi select error

Server side multi select error

chrischenchrischen Posts: 6Questions: 0Answers: 0
edited February 2010 in General
I'm getting this error: oSettings.aoData[iRow] is undefined on load and every time I click a row.

It seems to be triggered here:

/* Click event handler */
$('#example tbody tr').live('click', function () {
var aData = oTable.fnGetData( this ); <---- RIGHT HERE
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');
} );
If I change var aData = oTable.fnGetData( this ); to var aData = oTable.fnGetData(); The selecting works, however I don't think it's properly storing selection IDs in gaiSelected. Also if I remove "this" the error only shows up on load, and doesn't show up every time I click. But that's probably aData actually has something in it.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi chrischen,

    Are you using 1.6.x? The ability to pass 'this' (being a TR node) into fnGetData was added with 1.6.0. I presume that this is the basic example that you are working from: http://datatables.net/examples/server_side/select_rows.html ? It seems to work okay in there - so could you post an example showing the problem please. Should be able to track down the issue then!

    Regards,
    Allan
  • chrischenchrischen Posts: 6Questions: 0Answers: 0
    Yea that seemed to be the problem. I was using 1.5.6.

    Thanks for the quick response.
  • kekitokekito Posts: 15Questions: 0Answers: 0
    i ve the same problem, server site can't use selectable rows... really i don't know the problem.... could be do it by dom ? or something like this? so table is not in the dom, and event .click can't find the tr ---

    oTable = $('#table-list').dataTable({
    "oLanguage": {
    "sUrl": "language/spanish_table.txt"
    },
    "sPaginationType": "full_numbers",
    "bJQueryUI": true,
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "php/table-list.php"
    });

    $('#table-list tr').click( function() {
    alert("SI");
    if ( $(this).hasClass('row_selected') )
    $(this).removeClass('row_selected');
    else
    $(this).addClass('row_selected');
    } );

    please help me.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    @kekito - please don't cross post. This is the third reference to this specific problem. Future cross posts will be deleted.
This discussion has been closed.