further refactoring
This commit is contained in:
32
src/model.js
32
src/model.js
@@ -2,26 +2,27 @@ this.recline = this.recline || {};
|
||||
|
||||
// A Dataset model.
|
||||
recline.Dataset = Backbone.Model.extend({
|
||||
initialize: function(data, rawTabularData) {
|
||||
this.tabularData = new recline.TabularData(rawTabularData);
|
||||
initialize: function(data, rawDocumentSet) {
|
||||
this.documentSet = new recline.DocumentSet(rawDocumentSet);
|
||||
}
|
||||
|
||||
// get TabularData object associated with this Dataset
|
||||
//
|
||||
// async (as may involve getting data from the server) implementing standard promise API
|
||||
, getTabularData: function() {
|
||||
var dfd = $.Deferred();
|
||||
dfd.resolve(this.tabularData);
|
||||
return dfd.promise();
|
||||
}
|
||||
});
|
||||
|
||||
// TabularData model
|
||||
recline.TabularData = Backbone.Model.extend({
|
||||
recline.Document = Backbone.Model.extend({});
|
||||
|
||||
recline.DocumentList = Backbone.Collection.extend({
|
||||
// webStore: new WebStore(this.url),
|
||||
model: recline.Document
|
||||
})
|
||||
|
||||
recline.DocumentSet = Backbone.Model.extend({
|
||||
fetch: function(options) {
|
||||
options.success(this);
|
||||
},
|
||||
getLength: function() {
|
||||
return this.get('rows').length;
|
||||
}
|
||||
, getRows: function(numRows, start) {
|
||||
},
|
||||
getRows: function(numRows, start) {
|
||||
if (start === undefined) {
|
||||
start = 0;
|
||||
}
|
||||
@@ -33,4 +34,5 @@ recline.TabularData = Backbone.Model.extend({
|
||||
dfd.resolve(results);
|
||||
return dfd.promise();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user