1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    11
    Vote Rating
    0
    Robert_SK is on a distinguished road

      0  

    Default Problems with tabs & activate events

    Problems with tabs & activate events


    Hi,

    I am completely new to extjs. I am trying to build an application, with about 30 controllers, which I try to keep tidy, so that I won't get lost. For this reason I try to cling to the guidelines (as far as i can understand all this stuff).

    The application contains several tabpanel for editing complex records. When the user opens the panel, the first tab should be displayed. Everytime a tab is activated, the information should be refreshed.

    I try to put all application logic into controllers. However, I encounter various problems with generating and receiving activate events on tabs.

    If I put a listener directly into the tabpanel definition:

    I get activate event for the first tab when the tabpanel is displayed and for each tab, when it is activated. However, at the beginning I get one superfluous event from another unknown object (the tabpanel itself?).

    I can read attributes of the given tab and thus distinguish among individual tabs.

    However, when I put the listener into the controller:

    1. Selector of type 'tabpanel tab[attr=value]' does not work. I have to use just 'tabpanel tab'.

    2. The listener is called with some weirdo objects, neither of which seems to be a tab (according to the documentation it should be tabpanel, tab) I have to use something like tab.up('xtype').getActiveTab() to get access to the tab and its attributes.

    3. The worst thing is that 'activate' event is not fired when the first tab is already active upon entering into the panel. I tried to fire activate event by hand, but It just not work. I tried the following:

    tabpanel.setActivePad(0)
    tabpanel.getActivePad().fireEvent('activate')
    tabpanel.getActivePad().fireEvent('activate', tabpanel.getActivePad())

    without any success. I am just unable to fire the activate event.

    The activate event is supposed to carry out reloading the tab with fresh information. Is very hard to move the code outside the handler and call it from all entry points into the panel. I do need to get this working.

    What am I doing wrong? Or have I come accross a bug?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    A selector of 'tabpanel tab' will get you the tab button not the tab item. Are you wanting the tab button (the item in the tab bar)?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread