Cannot read property 'nTR' of undefined when trying to delete row
Cannot read property 'nTR' of undefined when trying to delete row
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?
[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?
This discussion has been closed.
Replies
Although I would like to fix the underlying issue.