[#113,docs/tutorial][l]: tutorial-basics written giving introduction to dataset and associated functionality.
* Minor corrections to several other parts of docs.
This commit is contained in:
25
src/model.js
25
src/model.js
@@ -225,6 +225,8 @@ my.Dataset = Backbone.Model.extend({
|
||||
return data;
|
||||
},
|
||||
|
||||
// ### getFieldsSummary
|
||||
//
|
||||
// Get a summary for each field in the form of a `Facet`.
|
||||
//
|
||||
// @return null as this is async function. Provides deferred/promise interface.
|
||||
@@ -250,6 +252,19 @@ my.Dataset = Backbone.Model.extend({
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
// ### recordSummary
|
||||
//
|
||||
// Get a simple html summary of a Dataset record in form of key/value list
|
||||
recordSummary: function(record) {
|
||||
var html = '';
|
||||
this.fields.each(function(field) {
|
||||
if (field.id != 'id') {
|
||||
html += '<div><strong span="key">' + field.get('label') + '</strong>: ' + record.getFieldValue(field) + '</div>';
|
||||
}
|
||||
});
|
||||
return html;
|
||||
},
|
||||
|
||||
// ### _backendFromString(backendString)
|
||||
//
|
||||
// See backend argument to initialize for details
|
||||
@@ -344,16 +359,6 @@ my.Record = Backbone.Model.extend({
|
||||
return val;
|
||||
},
|
||||
|
||||
summary: function(fields) {
|
||||
var html = '';
|
||||
for (key in this.attributes) {
|
||||
if (key != 'id') {
|
||||
html += '<div><strong>' + key + '</strong>: '+ this.attributes[key] + '</div>';
|
||||
}
|
||||
}
|
||||
return html;
|
||||
},
|
||||
|
||||
// Override Backbone save, fetch and destroy so they do nothing
|
||||
// Instead, Dataset object that created this Record should take care of
|
||||
// handling these changes (discovery will occur via event notifications)
|
||||
|
||||
Reference in New Issue
Block a user