Unable to add data in the middle of table and delete the last row

Unable to add data in the middle of table and delete the last row

Pratik21Pratik21 Posts: 3Questions: 0Answers: 0
edited February 2014 in DataTables 1.9
Hi,
I'm using DataTables 1.9 and I'm trying to add a row in the middle of the table. I have read other posts on this forum, where its said that I can use a hidden column as an index columns and then insert the new row at the appropiate index. This method works for me, but I was looking for a workaround as I do not want to change the indexes of the rows below the inserted row. Do you have a better method? My use case is just to show the added row as the first row.
Also, if I am trying to delete the last row of my table, using fnDeleteRow(), it gives an error saying 'cannot read property nTr of undefined'. This happens only if i pass the row to be deleted. If i pass the rowIndex, it works perfectly. Here's the fiddle for the same:
http://jsfiddle.net/NpT26/25/ - using rowData
http://jsfiddle.net/NpT26/22/ - using Index.
Can you explain me the cause of this error?

Thanks,
Pratik
This discussion has been closed.