diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index dbf7ae261f..f6ec60a728 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -135,7 +135,7 @@ function createStore () { var needPop = false; if (_global.Fix && this._store) { - var store = findStore(this.options.context || this.options.element); + var store = findStore(this.options.context || this._parent || this.options.element || BI.Widget.context || this._context); if (store) { pushTarget(store); needPop = true; diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 02cf54e8cb..bfe2652f51 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -32,7 +32,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { this._debounceRelease = BI.debounce(function () { self._scrollLock = false; }, 1000 / 60); - this.container = BI.createWidget({ + this.container = BI._lazyCreateWidget({ type: "bi.absolute" }); this.element.scroll(function () { @@ -47,7 +47,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { scrollTop: o.scrollTop }); }); - BI.createWidget({ + BI._lazyCreateWidget({ type: "bi.vertical", element: this, scrollable: o.overflowX === true && o.overflowY === true, @@ -176,7 +176,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { } renderedCells.push(child = this.renderedCells[index]); } else { - child = BI.createWidget(BI.extend({ + child = BI._lazyCreateWidget(BI.extend({ type: "bi.label", width: datum.width, height: datum.height @@ -377,4 +377,4 @@ BI.CollectionView = BI.inherit(BI.Widget, { } }); BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; -BI.shortcut("bi.collection_view", BI.CollectionView); \ No newline at end of file +BI.shortcut("bi.collection_view", BI.CollectionView); diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 056983b236..13231e59d7 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -35,7 +35,7 @@ BI.GridView = BI.inherit(BI.Widget, { this._debounceRelease = BI.debounce(function () { self._scrollLock = false; }, 1000 / 60); - this.container = BI.createWidget({ + this.container = BI._lazyCreateWidget({ type: "bi.absolute" }); this.element.scroll(function () { @@ -50,7 +50,7 @@ BI.GridView = BI.inherit(BI.Widget, { scrollTop: o.scrollTop }); }); - BI.createWidget({ + BI._lazyCreateWidget({ type: "bi.vertical", element: this, scrollable: o.overflowX === true && o.overflowY === true, @@ -153,7 +153,7 @@ BI.GridView = BI.inherit(BI.Widget, { child = this.renderedCells[index].el; renderedCells.push(this.renderedCells[index]); } else { - child = BI.createWidget(BI.extend({ + child = BI._lazyCreateWidget(BI.extend({ type: "bi.label", width: columnDatum.size, height: rowDatum.size diff --git a/src/core/shortcut.js b/src/core/shortcut.js index b377bac9fd..e14646c67d 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -11,7 +11,7 @@ }; // 根据配置属性生成widget - var createWidget = function (config, lazy) { + var createWidget = function (config, context, lazy) { var cls = kv[config.type]; if (!cls) { @@ -19,6 +19,7 @@ } var widget = new cls(); + widget._context = context; BI.Widget.pushContext(widget); widget._initProps(config); widget._initRoot(); @@ -57,7 +58,7 @@ BI.Plugin.getObject(el.type, this); } }]); - return w.type === el.type ? createWidget(w, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy); + return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy); } if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); @@ -68,7 +69,7 @@ BI.Plugin.getObject(el.type, this); } }]); - return w.type === el.type ? createWidget(w, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy); + return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy); } if (BI.isWidget(item.el)) { return item.el;