1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
    amans@marketgoal.com is on a distinguished road

      0  

    Default NavigationView doesn't navigate to other view

    NavigationView doesn't navigate to other view


    Hi,

    I am beginner in sencha and working with NavigationView control. I have two views viewOne.js and viewTwo.js. I want to navigate from viewOne.js to viewTwo.js. How can I do this? I am using below code:

    var view = Ext.create('Ext.NavigationView', {
    fullscreen: true,
    items: [{
    title: 'First',
    items: [{
    xtype: 'button',
    text: 'Push a new view!',
    handler: function () {
    // use the push() method to push another view. It works much like
    // add() or setActiveItem(). it accepts a view instance, or you can give it
    // a view config.
    view.push('viewTwo');
    }
    }]
    }]
    });

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    502
    Vote Rating
    55
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    You have to push an instance of a view, not the name of a class.

    So you'd need to, for instance, do something like this:
    Code:
    view.push(Ext.create('ViewTwo'));
    Where ViewTwo is the class name of the second view.

    Take a look at the MVC features of Sencha Touch 2 also. Ideally you'd push/pop views from a controller, and you'd have ViewTwo named something like MyApp.view.ViewTwo .

    For future, I think the Q&A forum is for specific issues people have with their code - you're more likely to get a prompt response there next time!

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
    amans@marketgoal.com is on a distinguished road

      0  

    Default


    Thanks! Shepsii. I just implemented the way you told me now it's working. From next time I will post my thread in Q&A forum.

Thread Participants: 1

Tags for this Thread