dojo的TabContainer中增加的ContentPane如果是closable,如何在关闭后不销毁ContentPane
2014-11-05 22:54
399 查看
主要思路是新建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"
});
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"
});
相关文章推荐
- dojo的TabContainer添加ContentPane假设closable,怎么不闭幕后予以销毁ContentPane
- Bootstrap技术: 如何给nav导航组件的tab页增加关闭按钮以及动态的添加和关闭tab页
- 使用dojo中的dijit的组件中TabContainer制作可以关闭的tab
- 如何给一个ContentPage动态增加Css 样式单
- 如何设置extextenders tabcontainer 加载时默认显示第一个TabPnel
- C#—Dev XtraTabControl动态增加Tab和关闭选项卡方法
- 右键点击修改Grid的单列值,及修改全表的值,还有相同点击事件的代码简化,及如何双击关闭一个tabsheet
- 如果分区满了,如何增加调整分区的容量
- C#—Dev XtraTabControl动态增加Tab和关闭选项卡方法
- 你的应用如何成为分享应用程序(share content) 或者 可以增加账户(add an account app list)的应用程序
- Qt窗体关闭时,如何自动销毁窗体类对象
- 如何给一个ContentPage动态增加Css 样式单
- 为火狐增加撤销关闭按钮扩展--Undo Closed Tabs Button
- [导入]真是笨,Firefox如何关闭TAB
- TabControl中内嵌窗体,如何触发内嵌窗体的关闭事件?
- c#如何实现双击TabContrl关闭Tab,隐藏tab标签
- dijit.layout.ContentPane--dojo学习
- Extjs中 TabPane如何内嵌其他网页
- Qt窗体关闭时,如何自动销毁窗体类对象
- 老男孩教育每日一题-2017-04-20:如果分区满了,如何增加调整分区的容量