QualityCell editing cleanup

pull/28/head
Mark McDowall 11 years ago
parent 7c915bd522
commit 5327068557

@ -26,7 +26,7 @@ define(
var templateName = self.template; var templateName = self.template;
self.schema = qualityProfileSchemaCollection.first(); self.schema = qualityProfileSchemaCollection.first();
var selected = _.find(self.schema.get('available'), { 'id': self.cell.cellValue.get('quality').id }); var selected = _.find(self.schema.get('available'), { 'id': self.model.get(self.column.get("name")).quality.id });
selected.selected = true; selected.selected = true;
self.templateFunction = Marionette.TemplateCache.get(templateName); self.templateFunction = Marionette.TemplateCache.get(templateName);
@ -61,10 +61,6 @@ define(
var command = new Backgrid.Command(e); var command = new Backgrid.Command(e);
model.trigger("backgrid:edited", model, column, command); model.trigger("backgrid:edited", model, column, command);
},
_setOptions: function (options) {
this.cell = options.cell
} }
}); });
}); });

@ -8,18 +8,19 @@ define(
_originalInit: Backgrid.Cell.prototype.initialize, _originalInit: Backgrid.Cell.prototype.initialize,
initialize: function () { initialize: function () {
this._originalInit.apply(this, arguments); this._originalInit.apply(this, arguments);
this.cellValue = this._getValue(); this.cellValue = this._getValue();
this.listenTo(this.model, 'change', this._refresh); this.listenTo(this.model, 'change', this._refresh);
this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) { if (this._onEdit) {
if (column.get("name") == this.column.get("name")) { this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) {
this._startEditing(model, column, cell, editor); if (column.get("name") == this.column.get("name")) {
} this._onEdit(model, column, cell, editor);
}); }
});
}
}, },
_refresh: function () { _refresh: function () {

@ -8,10 +8,6 @@ define(
className: 'quality-cell', className: 'quality-cell',
template : 'Cells/QualityCellTemplate', template : 'Cells/QualityCellTemplate',
editor : QualityCellEditor, editor : QualityCellEditor
_startEditing: function (model, column, cell, editor) {
editor._setOptions({ cell: cell });
}
}); });
}); });

Loading…
Cancel
Save