From 3c1d3dc5a521a5db8250bdc6f782687e27759d3b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 17 Jul 2019 15:27:18 +0800 Subject: [PATCH] =?UTF-8?q?BI-48176=20refactor:=20widget=E7=9A=84=5FsetEna?= =?UTF-8?q?ble=E5=92=8C=5FsetValid=E7=9A=84=E8=B0=83=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E6=9C=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/list/list.select.js | 4 ++-- src/core/widget.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 27a0227b0..7b2684f41 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -52,7 +52,7 @@ BI.SelectList = BI.inherit(BI.Widget, { callback.apply(self, arguments); if (op.times === 1) { self.toolbar.setVisible(items && items.length > 0); - self.toolbar.setEnable(items && items.length > 0); + self.toolbar.setEnable(!o.disabled && items && items.length > 0); } self._checkAllSelected(); }); @@ -160,7 +160,7 @@ BI.SelectList = BI.inherit(BI.Widget, { populate: function (items) { this.toolbar.setVisible(!BI.isEmptyArray(items)); - this.toolbar.setEnable(!BI.isEmptyArray(items)); + this.toolbar.setEnable(!this.options.disabled && !BI.isEmptyArray(items)); this.list.populate.apply(this.list, arguments); this._checkAllSelected(); }, diff --git a/src/core/widget.js b/src/core/widget.js index f6add3ff0..24c1e157e 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -185,16 +185,17 @@ * @private */ _mount: function (force, deep, lifeHook, predicate) { - var self = this; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { return false; } lifeHook !== false && this.beforeMount && this.beforeMount(); this._isMounted = true; this._mountChildren && this._mountChildren(); + if(BI.isNotNull(this._parent)) { + !this._parent.isEnabled() && this._setEnable(false); + !this._parent.isValid() && this._setValid(false); + } BI.each(this._children, function (i, widget) { - !self.isEnabled() && widget._setEnable(false); - !self.isValid() && widget._setValid(false); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); }); lifeHook !== false && this.mounted && this.mounted();