Problems with fnAddData
Problems with fnAddData
Hi, im having a very simple issue that i cant seem to figure out. I am getting strange behaviour when adding data to my table using fnAddData, heres some sample code
[code]
updateData: function(){
var table = $("#" + this.el.id + " #datatable").dataTable();
table.fnClearTable();
table.fnAddData(
[["1","10","20","30"],["1","10","20","30"],["2","11","21","31"],["2","11","21","31"],["1","10","20","30"]]
);
table.fnAddData(this.model.get("tableData"));
console.log(this.model.get("tableData"));
},
[/code]
Here i try to add data to the table in two different ways,
1) adding hard coded data
2) adding data from my model (using backbone)
The console.log prints the following
[["1","10","20","30"],["1","10","20","30"],["2","11","21","31"],["2","11","21","31"],["1","10","20","30"]]
However, only the hard coded data looks good, when adding the model data i get only one row containing the first four characters of the data, it doesnt seem to recognize it as a 2d array.
[ [ " 1
I'm kind of new to the javascript world. Would really appreaciate some help. Thanks
/Eric
[code]
updateData: function(){
var table = $("#" + this.el.id + " #datatable").dataTable();
table.fnClearTable();
table.fnAddData(
[["1","10","20","30"],["1","10","20","30"],["2","11","21","31"],["2","11","21","31"],["1","10","20","30"]]
);
table.fnAddData(this.model.get("tableData"));
console.log(this.model.get("tableData"));
},
[/code]
Here i try to add data to the table in two different ways,
1) adding hard coded data
2) adding data from my model (using backbone)
The console.log prints the following
[["1","10","20","30"],["1","10","20","30"],["2","11","21","31"],["2","11","21","31"],["1","10","20","30"]]
However, only the hard coded data looks good, when adding the model data i get only one row containing the first four characters of the data, it doesnt seem to recognize it as a 2d array.
[ [ " 1
I'm kind of new to the javascript world. Would really appreaciate some help. Thanks
/Eric
This discussion has been closed.