導航:首頁 > 編程語言 > extjs關閉tab頁

extjs關閉tab頁

發布時間:2023-03-13 23:53:36

❶ 求解Extjs問題: 通過樹節點,打開一個頁面添加到tabpanel,關閉之後,再次打開不顯示頁面怎麼解決

Ext.getCmp("centerPanel").remove(e);

你都remove掉了怎麼可能還show回來,show對應的應該是hide

❷ extjs5中tabpanel滑鼠右鍵全部關閉如何實現

給你例子參考,關聯到右鍵就可以了
/**
* Plugin for adding a close context menu to tabs. Note that the menu respects
* the closable configuration on the tab. As such, commands like remove others
* and remove all will not remove items that are not closable.
*/
Ext.define('Ext.ux.TabCloseMenu', {
alias: 'plugin.tabclosemenu',

mixins: {
observable: 'Ext.util.Observable'
},

/**
* @cfg {String} closeTabText
* The text for closing the current tab.
*/
closeTabText: 'Close Tab',

/**
* @cfg {Boolean} showCloseOthers
* Indicates whether to show the 'Close Others' option.
*/
showCloseOthers: true,

/**
* @cfg {String} closeOthersTabsText
* The text for closing all tabs except the current one.
*/
closeOthersTabsText: 'Close Other Tabs',

/**
* @cfg {Boolean} showCloseAll
* Indicates whether to show the 'Close All' option.
*/
showCloseAll: true,

/**
* @cfg {String} closeAllTabsText
* The text for closing all tabs.
*/
closeAllTabsText: 'Close All Tabs',

/**
* @cfg {Array} extraItemsHead
* An array of additional context menu items to add to the front of the context menu.
*/
extraItemsHead: null,

/**
* @cfg {Array} extraItemsTail
* An array of additional context menu items to add to the end of the context menu.
*/
extraItemsTail: null,

// TODO - doc this.addEvents('aftermenu','beforemenu');

//public
constructor: function (config) {
this.mixins.observable.constructor.call(this, config);
},

init : function(tabpanel){
this.tabPanel = tabpanel;
this.tabBar = tabpanel.down("tabbar");

this.mon(this.tabPanel, {
scope: this,
afterlayout: this.onAfterLayout,
single: true
});
},

onAfterLayout: function() {
this.mon(this.tabBar.el, {
scope: this,
contextmenu: this.onContextMenu,
delegate: '.x-tab'
});
},

onBeforeDestroy : function(){
Ext.destroy(this.menu);
this.callParent(arguments);
},

// private
onContextMenu : function(event, target){
var me = this,
menu = me.createMenu(),
disableAll = true,
disableOthers = true,
tab = me.tabBar.getChildByElement(target),
index = me.tabBar.items.indexOf(tab);

me.item = me.tabPanel.getComponent(index);
menu.child('#close').setDisabled(!me.item.closable);

if (me.showCloseAll || me.showCloseOthers) {
me.tabPanel.items.each(function(item) {
if (item.closable) {
disableAll = false;
if (item != me.item) {
disableOthers = false;
return false;
}
}
return true;
});

if (me.showCloseAll) {
menu.child('#closeAll').setDisabled(disableAll);
}

if (me.showCloseOthers) {
menu.child('#closeOthers').setDisabled(disableOthers);
}
}

event.preventDefault();
me.fireEvent('beforemenu', menu, me.item, me);

menu.showAt(event.getXY());
},

createMenu : function() {
var me = this;

if (!me.menu) {
var items = [{
itemId: 'close',
text: me.closeTabText,
scope: me,
handler: me.onClose
}];

if (me.showCloseAll || me.showCloseOthers) {
items.push('-');
}

if (me.showCloseOthers) {
items.push({
itemId: 'closeOthers',
text: me.closeOthersTabsText,
scope: me,
handler: me.onCloseOthers
});
}

if (me.showCloseAll) {
items.push({
itemId: 'closeAll',
text: me.closeAllTabsText,
scope: me,
handler: me.onCloseAll
});
}

if (me.extraItemsHead) {
items = me.extraItemsHead.concat(items);
}

if (me.extraItemsTail) {
items = items.concat(me.extraItemsTail);
}

me.menu = Ext.create('Ext.menu.Menu', {
items: items,
listeners: {
hide: me.onHideMenu,
scope: me
}
});
}

return me.menu;
},

onHideMenu: function () {
var me = this;
me.fireEvent('aftermenu', me.menu, me);
},

onClose : function(){
this.tabPanel.remove(this.item);
},

onCloseOthers : function(){
this.doClose(true);
},

onCloseAll : function(){
this.doClose(false);
},

doClose : function(excludeActive){
var items = [];

this.tabPanel.items.each(function(item){
if(item.closable){
if(!excludeActive || item != this.item){
items.push(item);
}
}
}, this);

Ext.suspendLayouts();
Ext.Array.forEach(items, function(item){
this.tabPanel.remove(item);
}, this);
Ext.resumeLayouts(true);
}
});

❸ Extjs:關於關閉TabPanel標簽的問題

取得窗口的引用
在下一個窗口打開時
用前一個窗口的引用關閉

❹ extjs 如何關閉當前整個網頁

Extjs中關閉整個頁面需要用parent對象窗口打開的window對象。
例如:
有a,b兩個頁面,a頁面為主頁面,有按鈕一個,點擊按鈕彈出一個windows對象,在其中顯示b頁面。b頁面中也有一個按鈕,點擊關閉窗口。
a.htm (部分代碼)
<script type="text/javascript">
function openWindow(id,title,url,width,height){
var win = Ext.get(id)
if (win) {
win.close();
return;
}
win = new Ext.Window({
id:id,
title:title,
layout:'fit',
width:width,
height:height,
closeAction:'close',
collapsible:true,
plain: false,
resizable: true,
html : ''
});
win.show();
}

function myfunction(){
openWindow('b-win','窗口中打開b頁面','b.htm',400,300);
}
</script>
<input type="button" name="button1" value="打開窗口" onClick="myfunction()">

b.htm(部分代碼)
<script type="text/javascript">
function closewin(){
var win = parent.Ext.getCmp('b-win');
if (win) {win.close();}
}
</script>
<input type="button" name="button1" value="關閉a打開的窗口" onClick="closewin()">

閱讀全文

與extjs關閉tab頁相關的資料

熱點內容
可在線編程isp是什麼意思 瀏覽:34
iphone6s單手模式 瀏覽:79
vivo怎麼找刪除的app軟體 瀏覽:852
360裝機大師怎麼用教程 瀏覽:168
高一編程語言是什麼 瀏覽:421
phpword插入圖片 瀏覽:261
數控編程s300什麼意思 瀏覽:871
linuxab壓力測試 瀏覽:818
編程語言為什麼是c 瀏覽:797
悅me只能網關密碼錯誤 瀏覽:844
三星交集工具 瀏覽:939
資料庫中怎麼復製表結構 瀏覽:417
戴爾win10平板裝系統嗎 瀏覽:816
編程的變數名有哪些 瀏覽:124
360版本海島奇兵下載 瀏覽:370
常州ug數控編程培訓哪個學校好 瀏覽:802
資料庫的不等於怎麼寫 瀏覽:664
qq關閉送禮物動畫 瀏覽:128
京東健康碼在哪個文件夾里 瀏覽:891
數據線黑了怎麼消除 瀏覽:883

友情鏈接