aData undefined issue - (working with backbone and datatables)
aData undefined issue - (working with backbone and datatables)
I have a jsfiddle here: http://jsfiddle.net/mwagner72/ekgZk/
[code]
var Chapter = Backbone.Model;
var chapters = new Backbone.Collection();
chapters.add(new Chapter({page: 9, title: "The End"}));
chapters.add(new Chapter({page: 5, title: "The Middle"}));
chapters.add(new Chapter({page: 1, title: "The Beginning"}));
$('#table_id_3').dataTable({
"aoColumns": [
{ "sTitle": "Title", "mDataProp": "title" },
{ "sTitle": "Page #", "mDataProp": "page" }],
sAjaxSource: "",
sAjaxDataProp: "",
fnServerData: function( sSource, aoData, fnCallback ){
console.log(chapters.toJSON());
fnCallback(chapters.toJSON());
}
});
chapters.add(new Chapter({page: 4, title: "The next bunny"}));
table2.render();
var oTable = $('#table_id_3').dataTable();
console.log('redraw');
oTable.fnDraw();
console.log('after redraw');
[code]
The Above code works and I get a dataTable with my 3 rows in it.
If I add a bServerSide: true, I then get "Uncaught TypeError: Cannot read property 'length' of undefined" related to aData
[code]
var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json );
for ( var i=0, iLen=aData.length ; i
[code]
var Chapter = Backbone.Model;
var chapters = new Backbone.Collection();
chapters.add(new Chapter({page: 9, title: "The End"}));
chapters.add(new Chapter({page: 5, title: "The Middle"}));
chapters.add(new Chapter({page: 1, title: "The Beginning"}));
$('#table_id_3').dataTable({
"aoColumns": [
{ "sTitle": "Title", "mDataProp": "title" },
{ "sTitle": "Page #", "mDataProp": "page" }],
sAjaxSource: "",
sAjaxDataProp: "",
fnServerData: function( sSource, aoData, fnCallback ){
console.log(chapters.toJSON());
fnCallback(chapters.toJSON());
}
});
chapters.add(new Chapter({page: 4, title: "The next bunny"}));
table2.render();
var oTable = $('#table_id_3').dataTable();
console.log('redraw');
oTable.fnDraw();
console.log('after redraw');
[code]
The Above code works and I get a dataTable with my 3 rows in it.
If I add a bServerSide: true, I then get "Uncaught TypeError: Cannot read property 'length' of undefined" related to aData
[code]
var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json );
for ( var i=0, iLen=aData.length ; i
This discussion has been closed.