Cannot read property 'nTR' of undefined when trying to delete row

Cannot read property 'nTR' of undefined when trying to delete row

giggseygiggsey Posts: 2Questions: 0Answers: 0
edited November 2010 in General
This will be easier to show with code, so:

[code] tables['agent-list'] = $('#agent-list').dataTable({
"bJQueryUI": true,
"sScrollY": "100%",
"sScrollX": "100%",
"bInfo": false,
"bFilter": false,
"aaSorting": [[ 1, "asc" ]],
"bPaginate": false,
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
console.log(nRow);
for (var i = 0; i < 12; i++)
{
$('td:eq(' + i + ')', nRow).attr('original',aData[i]);
}
parseagentrow(nRow);
return nRow;
}
});

$.getJSON("data/agents.php", function(data) {
$.each(data, function(index, value) {
tables['agent-list'].fnAddData( [value[0],value[1],value[2],value[3],value[4],value[5],value[6],value[7],value[8],value[9],value[10],value[11],value[12]], false );
});
tables['agent-list'].fnDraw();

});[/code]

In parseagentrow(), it does some checks, and if eg. the third column matches 'TEXT', it deletes the row by calling:

[code]removeTableRow(tables['agent-list'],nRow);[/code]

[code]function removeTableRow(table,row)
{
console.debug(table);
console.debug(row);
table.fnDeleteRow(table.fnGetPosition(row),null,false);
}[/code]

The error I get is: Uncaught TypeError: Cannot read property 'nTr' of undefined - jquery.dataTables.min.js:54

Any ideas?

Replies

  • giggseygiggsey Posts: 2Questions: 0Answers: 0
    I've cheated slightly and just done a $(row).hide();

    Although I would like to fix the underlying issue.
This discussion has been closed.