---
title: "EXT TAB 标签页  关闭其它选项卡"
author: "wuyechun"
date: "2013-03-12T18:24:10Z"
tags: []
slug: "ext-tab"
draft: false
lastmod: "2013-03-12T18:24:10Z"
id: 1828344
url: "https://wuyechun.iteye.com/blog/1828344"
---

```
	Ext.getCmp("tabpanel").on("contextmenu",
					function(tabPanelObj, tab, e) {
						var contextMenu = new Ext.menu.Menu([ {
							id : tab.id + "-close",
							text : "关闭当前选项卡",
							handler : function() {
								tabPanelObj.remove(tab);
							}
						}, {
							id : tab.id + "-close-others",
							text : "关闭其它选项卡",
							handler : function() {
								tabPanelObj.items.each(function(item) {
									if (item.closable && item != tab) {
										tabPanelObj.remove(item)
									}
								}

								);
							}
						} ]);
						//显示Menu
						contextMenu.showAt(e.getPoint());
					});
```