1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    5
    Vote Rating
    0
    vijayagrawal is on a distinguished road

      0  

    Default Answered: navigating between views - without back button

    Answered: navigating between views - without back button


    I have a need to navigate to another view without back button showing in the new view.
    So basically I want to replace the current view with another view (imagine a login panel - when user logs in, i show the main view - user cannot back button to the login view since he/she is already logged in)

    On reading the sencha architect and sencha docs, it looks like I should use NavigationView, but the description of navigationview does not match my need (for example, i will never go back to login view and i dont need a back button)
    Please advise what I should use to navigate to another view programmatically.
    I was able to write the ontap event for my login button, but I dont know what code i can write in the ontap event handler to make sencha touch 2 navigate to another view.
    It appears i may have to add a controller, add views, refs to it etc.
    If yes, how do i obtain access to the controller object in the ontap event handler? and what API do i use to navigate to another view?

  2. You should use a container with a Card Layout then. You can reference the container and use setActiveItem() or animateActiveItem() (if you wan't different animations for each page). You don't necessarily have to add a controller, but it would be easier to learn how to use them from the beginning. This guide on Controllers can help you out. If you have itemId's or id's on your components, it'll be easy to reference them with the controller.

    If you don't want to use controllers, you can use other methods of retrieving references to items like Ext.ComponenQuery.query() or (item).down() / up() / getParent()

  3. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You should use a container with a Card Layout then. You can reference the container and use setActiveItem() or animateActiveItem() (if you wan't different animations for each page). You don't necessarily have to add a controller, but it would be easier to learn how to use them from the beginning. This guide on Controllers can help you out. If you have itemId's or id's on your components, it'll be easy to reference them with the controller.

    If you don't want to use controllers, you can use other methods of retrieving references to items like Ext.ComponenQuery.query() or (item).down() / up() / getParent()

  4. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    5
    Vote Rating
    0
    vijayagrawal is on a distinguished road

      0  

    Default


    Thanks, I will try it out. Interestingly, I do not see "Card Layout" anywhere in Sencha Architect - so looks like I will have to create it manually outside of the architect.

  5. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Really? That's odd. Though, I only trialed Sencha Architect so I wouldn't know for sure. I guess then you could always use the code editor.

  6. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    5
    Vote Rating
    0
    vijayagrawal is on a distinguished road

      0  

    Default


    Actually it is present - i didnt realize card layout is an attribute of container!
    Thank you so much for your help - I was able to get it to work with cardlayout

    Regards
    Vijay

Thread Participants: 1