1. #1
    Sencha User deepakgarg89's Avatar
    Join Date
    Nov 2012
    Location
    Gurgaon, India
    Posts
    43
    Vote Rating
    0
    Answers
    4
    deepakgarg89 is on a distinguished road

      0  

    Default Answered: Change view in sencha touch 2

    Answered: Change view in sencha touch 2


    I had make a controller in sencha touch 2 in which i am performing an ajax request.

    I want to change the view on suceess.

    Currently i am using
    var firststep = Ext.create('Myapp.view.Rangeselector'); Ext.getCmp('loginForm').destroy();
    Ext.Viewport.add(firststep);

    It is destroying loginForm but didn't load Rangeselector view.

    Can anyone please give me a solution.

  2. Hi deepakgarg89,

    try this:
    Code:
    var firststep = Ext.create('Myapp.view.Rangeselector');
    Ext.Viewport.setActiveItem(firststep);
    It's not enough to just add your view to the viewport, you already have to navigate to it

    Best regards,
    Schildi

  3. #2
    Sencha User deepakgarg89's Avatar
    Join Date
    Nov 2012
    Location
    Gurgaon, India
    Posts
    43
    Vote Rating
    0
    Answers
    4
    deepakgarg89 is on a distinguished road

      0  

    Default Change view in sencha touch 2

    Change view in sencha touch 2


    I had make a controller in sencha touch 2 in which i am performing an ajax request.

    I want to change the view on suceess.

    Currently i am using

    var firststep = Ext.create('Myapp.view.Rangeselector');
    Ext.getCmp('loginForm').destroy();

    Ext.Viewport.add(firststep);

    It is destroying loginForm but didn't load Rangeselector view.

    Can anyone please give me a solution.

  4. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    83
    Vote Rating
    11
    Answers
    16
    Schildi will become famous soon enough

      0  

    Default


    Hi deepakgarg89,

    try this:
    Code:
    var firststep = Ext.create('Myapp.view.Rangeselector');
    Ext.Viewport.setActiveItem(firststep);
    It's not enough to just add your view to the viewport, you already have to navigate to it

    Best regards,
    Schildi

  5. #4
    Sencha User deepakgarg89's Avatar
    Join Date
    Nov 2012
    Location
    Gurgaon, India
    Posts
    43
    Vote Rating
    0
    Answers
    4
    deepakgarg89 is on a distinguished road

      0  

    Default Hi Schildi,

    Hi Schildi,


    Thanks for reply, I will use it and than revert back on the same

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,107
    Vote Rating
    453
    Answers
    3155
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Use setActiveItem method. You can use this method a couple different ways.

    You can pass it a component instance or a config object. If it's a config object it will create an instance. If the component instance (created by passing an instance or if it was created via a config object) isn't an item then it will add the instance to the parent. Once that happens then it will make it the active item and display it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  7. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,107
    Vote Rating
    453
    Answers
    3155
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Just noticed you posted the same question twice in 2 different forums. Please do not do this, I have merged the threads.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  8. #7
    Sencha User deepakgarg89's Avatar
    Join Date
    Nov 2012
    Location
    Gurgaon, India
    Posts
    43
    Vote Rating
    0
    Answers
    4
    deepakgarg89 is on a distinguished road

      0  

    Default Thanks for reply mitchell,

    Thanks for reply mitchell,


    I will take care in future and post only in one forum

Tags for this Thread