-
8 Apr 2011 4:02 AM #1
TabItem close listener
TabItem close listener
Hello,
I have several tabs and need to do some action when tab is being closed,but it does not work,i dont know why
I use EXT GWT 2.2.3 and GWT 2.2.1 versionCode:TabItem ti = new TabItem(id); ti.setClosable(true); ti.addListener(Events.Close, new Listener<BaseEvent>() { public void handleEvent(BaseEvent arg0) { com.google.gwt.user.client.Window.alert(""); } }); tabPanel.add(ti);
-
8 Apr 2011 6:17 AM #2
Set Events.BeforeRemove listener on the TabPanel, Try this instead :
Code:tabPanel.addListener(Events.BeforeRemove, new Listener<TabPanelEvent>() { @Override public void handleEvent(TabPanelEvent evt) { if(true){ // U decide what this condition should be evt.setCancelled(true); } } });Odili Charles Opute
Proudly Nigerian
Blog
Cotributions
Ext.ux.Image
Ext.ux.Wizard
Ext.plugin.ModalNotice
Ext.plugin.ComboLoader
Ext.ux.form.ScreenshotField
-
8 Apr 2011 6:18 AM #3
The containing component can detect closing of the tabitem or rather the event before removal from the tabpanel. My code is something like :
Code:public void handleEvent(BaseEvent be) { try { if (be instanceof TabPanelEvent && be.getType() == Events.BeforeRemove) { TabItem tabItem = ((TabPanelEvent) be).getItem(); // do your thing } } catch (Exception e) { // exception handling code } }
-
8 Apr 2011 12:52 PM #4
BeforeClose : TabPanelEvent(tabPanel, item)
Fires before an item is closed by the user clicking the close icon. Listeners can cancel the action by calling BaseEvent.
You should see the API
-
11 Apr 2011 1:50 AM #5
Similar Threads
-
Memory leaks after TabItem close
By jeroni in forum Ext GWT: Help & Discussion (1.x)Replies: 2Last Post: 29 Mar 2010, 7:41 AM -
open a tabitem close on an event
By jocy in forum Ext GWT: DiscussionReplies: 2Last Post: 2 Feb 2010, 6:41 AM -
MessageBox to Confirm close tabitem gxt 2.0.1
By Castro in forum Ext GWT: DiscussionReplies: 5Last Post: 13 Aug 2009, 12:42 AM -
Handling close event in tabitem
By avilanchee in forum Ext GWT: DiscussionReplies: 1Last Post: 2 Jun 2009, 12:19 AM -
How to add a close button on the tabItem title
By javist in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 4 Nov 2006, 4:22 PM


Reply With Quote
