1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    69
    Vote Rating
    0
    jonhobbs is on a distinguished road

      0  

    Default Switching views using a button

    Switching views using a button


    Hi Guys,

    This should be a simple one hopefully....

    I've created two views in Sencha designer, a splash screen and a registration form. The splash screen has a "register" button on it and when it's tapped I'd like to switch from the splash screen to the registration view.

    I'm not using a navigation view because I don't want a title bar on the splash screen. I'm also not using a card layout or anything like that, just two distinct views.

    So, do I use the 'tap' action on the button and put the code in there or should I put the logic in a controller?

    Also, should I Hide/Show the views or should I create/destroy them?

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Sounds like you should be using a container with a card layout.

    On tap you will just want to invoke setActiveItem for the next card.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Apr 2008
    Posts
    69
    Vote Rating
    0
    jonhobbs is on a distinguished road

      0  

    Default


    Thanks Aaron,

    I think in this instance the card layout will work, but once the user has registered or logged in I'd like to take them to a completely fresh view as they won't be going back to the splash screen again. Is tere a way to do what I'm trying to do or should I just keep nesting card layouts and not worry about keeping lots of views in memory?

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    remove and destroy the register page once its been used
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User
    Join Date
    Apr 2008
    Posts
    69
    Vote Rating
    0
    jonhobbs is on a distinguished road

      0  

    Default


    Sorry, I'm a complete beginner and I was asking how to do this. Where does the logic go, in the button tap event or in some kind of controller?

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    It can go in either place. You'll want to set the activeItem to the other page, remove the old item and destroy it.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Sencha User
    Join Date
    Apr 2008
    Posts
    69
    Vote Rating
    0
    jonhobbs is on a distinguished road

      0  

    Default


    OK, thanks Aaron, I'll give it a go.

Thread Participants: 1