diff --git a/bi/base.js b/bi/base.js index 9f79c10d1..661427432 100644 --- a/bi/base.js +++ b/bi/base.js @@ -15109,15 +15109,16 @@ BI.FloatBox = BI.inherit(BI.Widget, { populate: function (sectionProvider) { var self = this; + if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { + this.currentSectionProvider.destroy(); + } this.currentSectionProvider = sectionProvider; sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildSouth(this._south); - if (sectionProvider instanceof BI.Widget) { - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); - }) - } + sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { + self.close(); + }) }, show: function () { @@ -15140,6 +15141,10 @@ BI.FloatBox = BI.inherit(BI.Widget, { setZindex: function (zindex) { this.element.css({"z-index": zindex}); + }, + + destroyed: function () { + this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); diff --git a/bi/case.js b/bi/case.js index b70256eb6..d98ac5789 100644 --- a/bi/case.js +++ b/bi/case.js @@ -3567,9 +3567,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, { return BI.isFunction(o.copy) ? o.copy() : o.copy; } }); - this.clipboard.on("success", function (e) { - o.afterCopy(); - }) + this.clipboard.on("success", o.afterCopy) } else { this.element.zclip({ path: BI.resourceURL + "/ZeroClipboard.swf", diff --git a/bi/core.js b/bi/core.js index 2e88efc9b..e7aa96ebc 100644 --- a/bi/core.js +++ b/bi/core.js @@ -4198,6 +4198,7 @@ BI.OB = function (config) { $.extend(BI.OB.prototype, { props: {}, init: null, + destroyed: null, _defaultConfig: function (config) { return {}; @@ -4317,6 +4318,11 @@ $.extend(BI.OB.prototype, { } } return true; + }, + + destroy: function () { + this.destroyed && this.destroyed(); + this.purgeListeners(); } });/** * Widget超类 diff --git a/docs/base.js b/docs/base.js index 9f79c10d1..661427432 100644 --- a/docs/base.js +++ b/docs/base.js @@ -15109,15 +15109,16 @@ BI.FloatBox = BI.inherit(BI.Widget, { populate: function (sectionProvider) { var self = this; + if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { + this.currentSectionProvider.destroy(); + } this.currentSectionProvider = sectionProvider; sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildSouth(this._south); - if (sectionProvider instanceof BI.Widget) { - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); - }) - } + sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { + self.close(); + }) }, show: function () { @@ -15140,6 +15141,10 @@ BI.FloatBox = BI.inherit(BI.Widget, { setZindex: function (zindex) { this.element.css({"z-index": zindex}); + }, + + destroyed: function () { + this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); diff --git a/docs/case.js b/docs/case.js index b70256eb6..d98ac5789 100644 --- a/docs/case.js +++ b/docs/case.js @@ -3567,9 +3567,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, { return BI.isFunction(o.copy) ? o.copy() : o.copy; } }); - this.clipboard.on("success", function (e) { - o.afterCopy(); - }) + this.clipboard.on("success", o.afterCopy) } else { this.element.zclip({ path: BI.resourceURL + "/ZeroClipboard.swf", diff --git a/docs/core.js b/docs/core.js index 854962a55..e87cd01c6 100644 --- a/docs/core.js +++ b/docs/core.js @@ -14200,6 +14200,7 @@ BI.OB = function (config) { $.extend(BI.OB.prototype, { props: {}, init: null, + destroyed: null, _defaultConfig: function (config) { return {}; @@ -14319,6 +14320,11 @@ $.extend(BI.OB.prototype, { } } return true; + }, + + destroy: function () { + this.destroyed && this.destroyed(); + this.purgeListeners(); } });/** * Widget超类 diff --git a/src/base/layer/layer.floatbox.js b/src/base/layer/layer.floatbox.js index c015e76eb..8f4b7002a 100644 --- a/src/base/layer/layer.floatbox.js +++ b/src/base/layer/layer.floatbox.js @@ -105,15 +105,16 @@ BI.FloatBox = BI.inherit(BI.Widget, { populate: function (sectionProvider) { var self = this; + if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { + this.currentSectionProvider.destroy(); + } this.currentSectionProvider = sectionProvider; sectionProvider.rebuildNorth(this._north); sectionProvider.rebuildCenter(this._center); sectionProvider.rebuildSouth(this._south); - if (sectionProvider instanceof BI.Widget) { - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); - }) - } + sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { + self.close(); + }) }, show: function () { @@ -136,6 +137,10 @@ BI.FloatBox = BI.inherit(BI.Widget, { setZindex: function (zindex) { this.element.css({"z-index": zindex}); + }, + + destroyed: function () { + this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); diff --git a/src/case/clipboard/index.js b/src/case/clipboard/index.js index 1b9327d08..314cf2e5e 100644 --- a/src/case/clipboard/index.js +++ b/src/case/clipboard/index.js @@ -25,9 +25,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, { return BI.isFunction(o.copy) ? o.copy() : o.copy; } }); - this.clipboard.on("success", function (e) { - o.afterCopy(); - }) + this.clipboard.on("success", o.afterCopy) } else { this.element.zclip({ path: BI.resourceURL + "/ZeroClipboard.swf", diff --git a/src/core/ob.js b/src/core/ob.js index bb71c3874..51848c34f 100644 --- a/src/core/ob.js +++ b/src/core/ob.js @@ -15,6 +15,7 @@ BI.OB = function (config) { $.extend(BI.OB.prototype, { props: {}, init: null, + destroyed: null, _defaultConfig: function (config) { return {}; @@ -134,5 +135,10 @@ $.extend(BI.OB.prototype, { } } return true; + }, + + destroy: function () { + this.destroyed && this.destroyed(); + this.purgeListeners(); } }); \ No newline at end of file