After fnDeleteRow , fnUpdateRow wont work. _aData of undefined error

After fnDeleteRow , fnUpdateRow wont work. _aData of undefined error

WhitecastleWhitecastle Posts: 2Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
My simple table initialization:

[code]
oTable = $('#mytable').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"oLanguage": {
"sUrl": "pt_PT.txt"
}
});
[/code]

How do i add a row:

[code]
function fnClickAddRow(JSON) {

var sdate = convertDate(JSON.start,"yyyy-MM-dd");
var edate = convertDate(JSON.end,"yyyy-MM-dd");

var removebutton = 'Remove row'; //numberOfRows is a global var

var line = numberOfRows;
var newRow = oTable.fnAddData([line,JSON.title,sdate,edate,removebutton]);
var thenode = oTable.fnSettings().aoData[ newRow[0] ].nTr;
thenode.setAttribute('id',numberOfRows); //Here i add a row attribute for example

}
[/code]

How do i remove:

(in this point, before i remove fnUpdate works well )

[code]
function fnRemoveRow(idrow)
{
oTable.fnDeleteRow($('#'+idrow)[0]);
}

[/code]

Removing the rows works well it is removed. Is this the correct way to delete?

How do i update a row:

[code]

function fnUpdateRow(eventToUpdate,di,df){

var line = eventToUpdate.id;
var sdate = convertDate(di,"yyyy-MM-dd");
var edate = convertDate(df,"yyyy-MM-dd");
var removebutton = 'Remove row';

oTable.fnUpdate( [line, eventToUpdate.title, sdate, edate,removebutton], line ); // Row
}

[/code]

The problem is, when i add rows like 10 or more or only one it doesn't matter, fnUpdateRow() allways work well, but when i remove only one row from the 10 rows or the single row,add another row and try to update it gives me the Cannot set property '_aData' of undefined.

Replies

  • WhitecastleWhitecastle Posts: 2Questions: 0Answers: 0
    I'm new here, i didn´t saw the thread about posting a working example to get help. I'm at work right know so when i get home i will try to do a working example to reproduce the problem.

    Meanwhile if someone could be so kind and try to see the problem i would be very apreciated.

    Thank you
This discussion has been closed.