您的位置:首页 > 大数据 > 人工智能

dojo的TabContainer添加ContentPane假设closable,怎么不闭幕后予以销毁ContentPane

2015-09-16 14:39 246 查看
其主要思想是新的TabContainer的扩展类,重载其closeChild属性,使得其在关闭子容器时。不调用该子容器的destroyRecursive方法。

define([ "dojo/_base/declare", "dijit/layout/TabContainer"

], function(declare,TabContainer) {

return declare("comm.comm.ExTabContainer", TabContainer, {

closeChildAction:"destroy",

closeChild: function(/*dijit/_WidgetBase*/ page){

// summary:

// Callback when user clicks the [X] to remove a page.

// If onClose() returns true then remove and destroy the child.

// tags:

// private

var remove = page.onClose && page.onClose(this, page);

if(remove){

this.removeChild(page);

if (this.closeChildAction=="destroy"){

// makes sure we can clean up executeScripts in ContentPane onUnLoad

page.destroyRecursive();

}

}

}

});

});

然后创建TabContainer的方法例如以下:

var tc=new ExTabContainer({

style : "height: 100%; width: 100%;",

isLayoutContainer : true,

region : 'center',

closeChildAction:"hide"

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: