1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    8
    Vote Rating
    0
    MatthiasCyber is on a distinguished road

      0  

    Default Link on TabPanel

    Link on TabPanel


    Hello everyone,

    I'm trying to do a link when clicking on a Tab item in a TabPanel. I mean, when I click on the Tab, it must redirect me on another page.

    Can we do that? And if we can, how can we?

    Thanks for the support and for ExtJS

  2. #2
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    You can used listeners on tabpanel

    PHP Code:
      listeners: {
        
    tabchange: function (tabpaneltab) {
          if(....) {
    document.location.href 'http://www....';}
        }
      } 

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    8
    Vote Rating
    0
    MatthiasCyber is on a distinguished road

      0  

    Default


    It's tryed what you said but I dunno where to put the code you gave to me. I've tryied like that:
    Code:
    {
                	name: 'TabDeco',
                    title: 'Déconnexion',
                    listeners: {
                        tabchange: function (TabPanel, TabDeco) {
                          {document.location.href = '/pages/logout';}
                        }
                      }  
    
                }
    But doesn't work, so, what do I do?

    Thanks

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    51
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Which class offers a tabchange event?

    Does it fire on the individual tabs?

    You must know, since you read the API docs to actually find that event!

  5. #5
    Ext User
    Join Date
    Aug 2010
    Posts
    8
    Vote Rating
    0
    MatthiasCyber is on a distinguished road

      0  

    Default


    Wich class, what do you mean ? It's the TabPanel item that got a tabchange Event,

    From that, how can I do what I want?

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    51
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    As above. If you really think it's a good idea. Which it's not.

  7. #7
    Ext User
    Join Date
    Aug 2010
    Posts
    8
    Vote Rating
    0
    MatthiasCyber is on a distinguished road

      0  

    Default


    I don't understand what do you mean by that. It's not a good idea to redirect to somewhere else when clicking on a tab?

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    51
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    No. What's the point in a TabPanel if you don't let it be a TabPanel?

  9. #9
    Ext User
    Join Date
    Aug 2010
    Posts
    8
    Vote Rating
    0
    MatthiasCyber is on a distinguished road

      0  

    Default


    Here is what I wanna do:
    When I click on the "Déconnexion" tab, it go to the login page.

  10. #10
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    PHP Code:
    var tabPanel = new Ext.TabPanel({
      
    renderToExt.getBody(),
      
    activeTab0,
      
    items: [{
        
    title'Tab 1',
        
    html'A simple tab'
      
    },{
        
    title'Tab 2',
        
    html'Another one'
      
    }],
      
    listeners: {
        
    tabchange: function (tabpaneltab) {
          if(
    tab.title === 'Tab 2') {  // << only for example, it's awfull to use on your code ))
            
    document.location.href 'http://www....';
          }
        }
      }
    }); 

Similar Threads

  1. How to add a link after tabs in TabPanel
    By thiner in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 9 Oct 2009, 1:47 AM
  2. Adding a link to TabPanel
    By ngd in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 19 May 2009, 1:52 AM
  3. Make TabPanel item follow link using beforetabchange
    By Maus in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 8 Jan 2009, 9:18 AM
  4. Make a link into the same tabpanel
    By gillesCezar in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 28 Feb 2008, 1:57 AM
  5. Get a link to work from a TabPanel
    By ajaya in forum Ext 2.x: Help & Discussion
    Replies: 14
    Last Post: 11 Nov 2007, 11:38 AM

Thread Participants: 2