You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
883 B
41 lines
883 B
12 years ago
|
"use strict";
|
||
|
|
||
|
define(['app'], function () {
|
||
|
NzbDrone.Cells.NzbDroneCell = Backgrid.Cell.extend({
|
||
|
|
||
|
_originalInit: Backgrid.Cell.prototype.initialize,
|
||
|
|
||
|
|
||
|
initialize: function () {
|
||
|
this._originalInit.apply(this, arguments);
|
||
|
this.cellValue = this._getValue();
|
||
|
|
||
|
this.model.on('change', this._refresh, this);
|
||
|
},
|
||
|
|
||
|
_refresh: function () {
|
||
|
this.cellValue = this._getValue();
|
||
|
this.render();
|
||
|
},
|
||
|
|
||
|
_getValue: function () {
|
||
|
|
||
|
var name = this.column.get('name');
|
||
|
|
||
|
if(name === 'this'){
|
||
|
return this.model;
|
||
|
}
|
||
|
|
||
|
var value = this.model.get(name);
|
||
|
|
||
|
//if not a model
|
||
|
if (!value.get) {
|
||
|
return value = new Backbone.Model(value);
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
});
|