1. #1
    Sencha User Zeitwaechter's Avatar
    Join Date
    May 2012
    Location
    Bonn
    Posts
    4
    Vote Rating
    0
    Zeitwaechter is on a distinguished road

      0  

    Default Destroy or switch controller [answered]

    Destroy or switch controller [answered]


    Hello folks,

    I'm really new to ExtJS and run right into a problem:

    I would like to destroy or switch a Controller after pushing a button.
    This should be made without a page refresh - just a reload of the content.

    I searched the forum and the web but found anything useful.

    In detail:
    I got the two controllers 'Search1.js' and 'Search2.js'. Search1 is initialized at the start of the application.
    After pushing the button, I would like to change from Controller Search1 to Controller Search2.

    -------
    What I understand so far:
    It's not really possible to "destory" a Controller, after it's inizialized, because the method destroy doesn't exist in it's context (http://docs.sencha.com/ext-js/4-1/#!...app.Controller).

    What I got so far:
    - I'm able to initialize a class via pushing a button in the Viewport-context.
    - It works without refreshing the page, just reloading the data.

    I tried many things but they all where no help for me.
    My last try ended up like this (part of the Viewport.js-context):
    Code:
    {
            xtype         : 'button', 
            ident         : 'MindControll',
            itemId        : 'changeButton',
            componentCls  : 'change-button-caption',
            height        : 25,
            margin        : '0 0 0 3',
            text          : 'ChangeController',
            handler: function() {
                    App_SearchController1.destroy;
                    App_SearchController2.init();
                    
                    console.log('App_SearchController1', App_SearchController1);
                    console.log('App_SearchController2', App_SearchController2);
            }
    }
    Is it even possible to change the active Controller or is there another (much better) way to realize what I need (without tabs)?
    In my opinion it isn't the right way how to solve this task but it's the only thing I could imagine.

    I hope you can help me - and thanks in advance.

    Greetings
    Zeitwaechter

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,483
    Vote Rating
    219
    LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of

      0  

    Default


    See this thread. There was a solution provided that you may find interesting.

  3. #3
    Sencha User Zeitwaechter's Avatar
    Join Date
    May 2012
    Location
    Bonn
    Posts
    4
    Vote Rating
    0
    Zeitwaechter is on a distinguished road

      0  

    Default


    Hi,

    even though I have to admit that I'm still tryin' to get mankz or mitchellsimoens solution to work in my application it seems that those solutions could do, what I want them to do.

    Thank you very much.

    I'll mail again, after I got it.

    --Edit---
    We don't need this solution anymore.
    Thanks anyway

    --Edit---

    Greetings

Thread Participants: 1

Tags for this Thread