Titanium JIRA Archive
Alloy (ALOY)

[ALOY-990] Alloy : createCollection() should accept 'options' as an argument

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
Reporter曹俊
AssigneeFeon Sua Xin Miao
Created2014-04-17T03:35:48.000+0000
Updated2014-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);
};

Comments

  1. Ritu Agrawal 2014-04-23

    Moving this ticket to engineering for further evaluation.

JSON Source