Backbone and datatables
Backbone and datatables
I have a jsfiddle here: http://jsfiddle.net/mwagner72/ekgZk/17/
[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('here we go');
fnCallback(chapters.toJSON());
}
});
[/code]
Doing this I have the dataTable linked up to my collection, but how do I tell it to refresh against the Server Data?
[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('here we go');
fnCallback(chapters.toJSON());
}
});
[/code]
Doing this I have the dataTable linked up to my collection, but how do I tell it to refresh against the Server Data?
This discussion has been closed.
Replies
Allan
I have updated my jsfiddle: http://jsfiddle.net/mwagner72/ekgZk/