1. #1
    Sencha User
    Join Date
    Jan 2010
    Posts
    132
    Answers
    2
    Vote Rating
    1
    darkling235 is on a distinguished road

      0  

    Default Answered: How to select regenerated Tab

    Answered: How to select regenerated Tab


    What is the correct way to programtically move a user to a certain tab?

    My application has a group of data driven forms on a series of tabs. These tabs are torn down and rebuilt every CRUD operation (because the number and types of them can change).


    Because I'm tearing them down and rebuilding them, every time the user hits the save button he arrives back at the zero-th tab. Can anyone give me suggestions on how to accomplish this?

    I'm struggling to do it right now. When I call getTabIndex to try and save what tab the user is on right now I usually get 0 back.
    I've tried using setActiveWidget to move the user back. I save a reference to a tab and then after rebuild try to use it but because my saved reference of a tab is now gone, the tabPanel won't match against it.

    Any suggestions?
    Thanks

  2. I don't understand the problem - are you saying that tabPanel.setActiveWidget(tabPanel.getWidget(0)) isn't selecting the zeroth tab and showing its contents?

    TabPanel implements IndexedPanel to allow iterating through the widget children. There is also a findItem(String,boolean) method that searches the tab text and returns the matching widget.

    The getTabIndex()/setTabIndex(int) methods are totally unrelated to this - these methods are defined in Component, and refer to how the browser handles the tab key when moving from the focused element to the next (currently unfocused) element.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    I don't understand the problem - are you saying that tabPanel.setActiveWidget(tabPanel.getWidget(0)) isn't selecting the zeroth tab and showing its contents?

    TabPanel implements IndexedPanel to allow iterating through the widget children. There is also a findItem(String,boolean) method that searches the tab text and returns the matching widget.

    The getTabIndex()/setTabIndex(int) methods are totally unrelated to this - these methods are defined in Component, and refer to how the browser handles the tab key when moving from the focused element to the next (currently unfocused) element.

  4. #3
    Sencha User
    Join Date
    Jan 2010
    Posts
    132
    Answers
    2
    Vote Rating
    1
    darkling235 is on a distinguished road

      0  

    Default


    Yes that does work thank you.
    I got completely mixed up about when to use getTabeIndex and getWidget

Thread Participants: 1