ExtJs TabPanel右键功能插件
2012-11-05 16:34
281 查看
Js代码
Ext.ux.TabCloseMenu = function(){
var tabs, menu, ctxItem;
this.init = function(tp){
tabs = tp;
tabs.on('contextmenu', onContextMenu);
}
function onContextMenu(ts, item, e){
if(!menu){ // create context menu on first right click
menu = new Ext.menu.Menu([{
id: tabs.id + '-close',
text: syscommon.closetab,
handler : function(){
tabs.remove(ctxItem,false);
}
},{
id: tabs.id + '-close-others',
text:syscommon.closealltab,
handler : function(){
tabs.items.each(function(item){
if(item.closable && item != ctxItem){
tabs.remove(item,false);
}
});
}
},{
id: tabs.id + '-close-all',
text: syscommon.closeothertab,
handler : function(){
tabs.items.each(function(item){
if(item.closable){
tabs.remove(item,false);
}
});
}
}]);
}
ctxItem = item;
var items = menu.items;
items.get(tabs.id + '-close').setDisabled(!item.closable);
var disableOthers = true;
tabs.items.each(function(){
if(this != item && this.closable){
disableOthers = false;
return false;
}
});
items.get(tabs.id + '-close-others').setDisabled(disableOthers);
var disableAll = true;
tabs.items.each(function(){
if(this.closable){
disableAll = false;
return false;
}
});
items.get(tabs.id + '-close-all').setDisabled(disableAll);
menu.showAt(e.getPoint());
}
};
使用方法很简单:
在TabPanel上加上这句,plugins : new Ext.ux.TabCloseMenu()
相关文章推荐
- ExtJs TabPanel右键功能插件Ext.ux.TabCloseMenu
- 为extjs的TabPanel 添加右键关闭效果(修改一个bug)
- Extjs4 tab添加右键刷新功能
- 为extjs的TabPanel 添加右键关闭效果(修改一个bug)
- Ext.ux.TabCloseMenu插件的使用(TabPanel右键关闭菜单) 示例
- ExtJs4-Ext.tab.Panel添右键关闭
- EXTJS_Tabpanel布局,选项卡加载页面,调用别的jsp页面,截图所示
- ExtJs中tabPanel放置iframe无法兼容IE6的解决方法
- extjs tree激活tabPanel
- jQuery插件之Tabpanel
- ExtJs基础知识总结:Dom、IFrame和TreePanel、TabPanel(三)
- 转:ExtJS:tabpanel 多个tab同时渲染问题
- ExtJs4.2学习--Ext.tab.Panel 选项卡
- extjs的tabpanel事件
- ExtJs_Ext.TabPanel解释
- Extjs中通过Tree加载右侧TabPanel具体实现
- ExtJs tree tabpanel 布局
- ExtJs 学习笔记 Ext.Panle Ext.TabPanel Ext.Viewport(转)
- 【Extjs6】给tabpanel添加右键菜单
- ExtJs4 笔记(10) Ext.tab.Panel 选项卡