[ALOY-990] Alloy : createCollection() should accept 'options' as an argument
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | 曹俊 |
Assignee | Feon Sua Xin Miao |
Created | 2014-04-17T03:35:48.000+0000 |
Updated | 2014-06-18T22:54:10.000+0000 |
Description
Backbone.js model and collection creation functions accept an options argument, which Alloy's wrappers do not support.
In alloy.js
exports.createCollection = function(name, args) {
return new (require('alloy/models/' + ucfirst(name)).Collection)(args);
};
In backbone.js
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, {silent: true, parse: options.parse});
};
//It should fix it like this:
exports.createCollection = function(name, attributes, options) {
return new (require('alloy/models/' + ucfirst(name)).Collection)(attributes, options);
};
Moving this ticket to engineering for further evaluation.