1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    16
    Vote Rating
    0
    dato.java is on a distinguished road

      0  

    Default 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

    Code:
                    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);
    I use EXT GWT 2.2.3 and GWT 2.2.1 version

  2. #2
    Sencha User chalu's Avatar
    Join Date
    Feb 2008
    Location
    Benin City, Nigeria
    Posts
    480
    Vote Rating
    1
    chalu is on a distinguished road

      0  

    Default


    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);
                 }
    	}
    });

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Location
    Flanders
    Posts
    45
    Vote Rating
    0
    daddieke is on a distinguished road

      0  

    Default


    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
            }
    }

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    40
    Vote Rating
    1
    liondev is on a distinguished road

      0  

    Default


    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

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    16
    Vote Rating
    0
    dato.java is on a distinguished road

      0  

    Default


    Thank you guys ,it works now

Similar Threads

  1. Memory leaks after TabItem close
    By jeroni in forum Ext GWT: Help & Discussion (1.x)
    Replies: 2
    Last Post: 29 Mar 2010, 7:41 AM
  2. open a tabitem close on an event
    By jocy in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 2 Feb 2010, 6:41 AM
  3. MessageBox to Confirm close tabitem gxt 2.0.1
    By Castro in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 13 Aug 2009, 12:42 AM
  4. Handling close event in tabitem
    By avilanchee in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 2 Jun 2009, 12:19 AM
  5. How to add a close button on the tabItem title
    By javist in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 4 Nov 2006, 4:22 PM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi