guy 2 years ago
parent
commit
f8f0c194b6
  1. 14
      src/base/context.js

14
src/base/context.js

@ -16,12 +16,12 @@ BI.Context = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
if (o.context) { if (o.context) {
this.$context = BI.useContext(o.context); this.context = BI.useContext(o.context);
} }
this.context = BI.createWidget((o.items[0] || o.el)(this.$context), { this.widget = BI.createWidget((o.items[0] || o.el)(this.context), {
element: this, element: this,
}); });
this.context.on(BI.Controller.EVENT_CHANGE, function () { this.widget.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
}, },
@ -29,19 +29,19 @@ BI.Context = BI.inherit(BI.Widget, {
__initWatch: function () { __initWatch: function () {
BI.Context.superclass.__initWatch.call(this); BI.Context.superclass.__initWatch.call(this);
var o = this.options; var o = this.options;
BI.watch(this.$context, o.context, o.watch); BI.watch(this.context, o.context, o.watch);
}, },
setValue: function (v) { setValue: function (v) {
this.context.setValue(v); this.widget.setValue(v);
}, },
getValue: function () { getValue: function () {
return this.context.getValue(); return this.widget.getValue();
}, },
populate: function () { populate: function () {
this.context.populate.apply(this, arguments); this.widget.populate.apply(this, arguments);
}, },
}); });
BI.shortcut("bi.context", BI.Context); BI.shortcut("bi.context", BI.Context);

Loading…
Cancel
Save