Problem facing in using of fnAddData for appending rows in the grid . Rows are not being displayed.
Problem facing in using of fnAddData for appending rows in the grid . Rows are not being displayed.
AshishG
Posts: 5Questions: 1Answers: 0
Hello Allan,
I am new to Datatables and still learning it. I am stuck at one place. I am using Datatable version 1.9 (So rows.add() cannot be used, i guess).
.success(function(data){
var rows = data.data;
for(var i =0; i<rows.length;i++){
var tempArray = [];
$.each(rows[i], function(k,v){
tempArray.push(v);
});
$('.grid').dataTable().fnAddData(tempArray,false);
}
console.log("success");
});
This discussion has been closed.
Answers
Since you are declaring the second parameter of false you need to call fnDraw after so something like:
or if you don't need to declare false, you could simply remove false and it should work!
Also make sure to call fnDraw outside of the for loop so that all of the rows are rendered first
@kevin But that's my concern, I don't want to redraw the table.
Is there a reason you cant use 1.10? If you are new why not just start with the newest release?
Also, I am not sure you can update your display without redrawing the table
Well, the existing project is on the top of 1.9 so using the legacy datatables only I have to solve this problem.