ExtJs4.2中Tab选项卡的右击关闭其它和关闭当前功能不准确的解决方法
一、ExtJs4.2中Tab选项卡的右击关闭其它和关闭当前功能不准确的解决方法

二、找到ux目录下的TabCloseMenu.js文件,将内容替换成下面代码。
三、代码:
/**
* 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',
showCloseOthers: true,
closeOthersTabsText: 'Close Other Tabs', /**
* @cfg {Boolean} showCloseAll
* Indicates whether to show the 'Close All' option.
*/
showCloseAll: true,
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, //public
constructor: function (config) {
this.addEvents(
'aftermenu',
'beforemenu'); 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); this.item = me.tabPanel.getComponent(index);
me.selectedTab = me.tabPanel.getComponent(index);
menu.child('*[text="' + me.closeTabText + '"]').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('*[text="' + me.closeAllTabsText + '"]').setDisabled(disableAll);
} if (me.showCloseOthers) {
menu.child('*[text="' + me.closeOthersTabsText + '"]').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 = [{
text: me.closeTabText,
scope: me,
handler: me.onClose
}]; if (me.showCloseAll || me.showCloseOthers) {
items.push('-');
} if (me.showCloseOthers) {
items.push({
text: me.closeOthersTabsText,
scope: me,
handler: me.onCloseOthers
});
} if (me.showCloseAll) {
items.push({
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.item = null;
me.fireEvent('aftermenu', me.menu, me);
}, onClose: function () {
this.tabPanel.remove(this.selectedTab);
}, 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.selectedTab) {
items.push(item);
}
}
}, this); Ext.each(items, function (item) {
this.tabPanel.remove(item);
}, this);
}
});
ExtJs4.2中Tab选项卡的右击关闭其它和关闭当前功能不准确的解决方法的更多相关文章
- WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法
文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...
- zend studio中ctrl+鼠标左键无法转到类或函数定义文件的解决方法
转载自:http://blog.csdn.net/wide288/article/details/21622183 zend studio中ctrl+鼠标左键无法转到类或函数定义文件的解决方法: ze ...
- Bootstrap Modal 关闭时右侧滚动条消失,页面左移的解决方法
问题描述:页面在打开Modal之前右侧有滚动条,Modal关闭之后,body中的class="modal-open"和style="padding-right: 17px ...
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- 网页中"IE限制网页访问脚本或ActiveX控件"的提示问题的解决方法
以前从来没有注意过"IE限制网页访问脚本或ActiveX控件"的提示问题,对于这个小细节问题,虽然感觉很别扭,但一直没考虑解决方法,今天才发现该问题可以轻松解决,以下做个小小记录. ...
- iframe中使用模态框提交表单后,iframe加载父页面的解决方法
在iframe中使用模态框提交表单后,会出现iframe加载整个父页面的问题,如下图: 解决方法: 在form表单中添加target属性 _parent 这个属性会使目标文档载入父窗口或者包含来超链接 ...
- Android开发中怎样用多进程、用多进程的好处、多进程的缺陷、解决方法(转)
转自:http://blog.csdn.net/spencer_hale/article/details/54968092 1.怎样用多进程 Android多进程概念:一般情况下,一个应用程序就是一个 ...
- Centos7.5中Nginx报错:nginx: [error] invalid PID number "" in "/run/nginx.pid" 解决方法
服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number "" ...
- NS2中couldn‘t read file “../tcl/mobility/scene/cbr-3-test“: no such file or directory解决方法
运行wireless.tcl 文件时报错:couldn't read file "../../uAMPS/ns-leach.tcl": no such file or direct ...
随机推荐
- Java Calendar,Date,DateFormat,TimeZone,Locale等时间相关内容的认知和使用(2) 自己封装的Calendar接口
本章主要是收藏一些常用的类和接口,包括:万年历(农历.阳历节日.阴历节日).自定义的Calendar接口. 万年历 源码如下(ChineseCalendar.java): package com.vi ...
- 论DELPHI三层的数据序列格式的变化
论DELPHI三层的数据序列格式的变化 要窥三层的数据序列格式,我们可以通过观察DELPHI官方的客户端内存表. 早先流行的是TClientDataSet,它的Data和Delta属性的数据类型都是: ...
- Java加密技术(一)——加密介绍
from://http://blog.csdn.net/janronehoo/article/details/7590772 如基本的单向加密算法: BASE64 严格地说,属于编码格式,而非加密算法 ...
- jquery 实现table的行列选中效果改进
行列都可以多选,也可对相应数据进行统计: 行选中效果 列选中效果
- SharePoint 2016 工作流报错“未安装应用程序管理共享服务代理”
前言 最近为SharePoint 2016环境,配置了状态机工作流,然后,用spd创建的时候可以保存,但是发布的时候报错,经过排查解决了问题,记录一下. 报错截图 下面是SharePoint Desi ...
- docker查看容器的网络ip
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id 可直 ...
- mysql 内存表
show variables like 'max_%'; max_heap_table_size 16777216 max_tmp_tables 32 show variables l ...
- python的重试库tenacity用法以及类似库retry、requests实现
介绍 tenacity is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simpli ...
- 【UOJ Round #1】
枚举/DP+排列组合 缩进优化 QAQ我当时一直在想:$min\{ \sum_{i=1}^n (\lfloor\frac{a[i]}{x}\rfloor + a[i] \ mod\ x) \}$ 然而 ...
- Tomcat6和Tomcat7配置SSL通信的比较
<Tomcat6和Tomcat7配置SSL通信的比较> 作者:chszs,转载需注明.博客主页: http://blog.csdn.net/chszs 在项目开发过程中,尝尝会遇到Tomc ...