1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    162
    Answers
    7
    Vote Rating
    2
    UbuntuPenguin is on a distinguished road

      0  

    Default Answered: Not catching the initialize and painted event

    Answered: Not catching the initialize and painted event


    Hello Everyone,
    I am using the view caching methodology. I was operating under the impression that when a view was shown, I would be able to listen to its initialize and/or painted event. However, I am not getting either of those. Here is the code that I am using to listen to those events.

    Code:
            refs:{
    
                storelocator:'mainview storelocator'
            },
    
    
            control:{
                .....
                storelocator : {
                    painted : 'onPainted',
                    initialize  : 'onInitialize'
                }
            }
    .....
        //Never gets hit
        onPainted : function( thing )
        {
            debugger;
        },
         //Never gets hit either
        onInitialize : function( thing )
        {
            debugger;
        },
    Should I be going about this a different way or am I doing something wrong.

  2. they won't be listenable in the controller, same with erased. You can listen for it on the view and fire an event on the view for the controller to listen for it.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    they won't be listenable in the controller, same with erased. You can listen for it on the view and fire an event on the view for the controller to listen for it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  4. #3
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    162
    Answers
    7
    Vote Rating
    2
    UbuntuPenguin is on a distinguished road

      0  

    Default


    Thanks Mitch. Would you mind explaining the drawbacks of using the 'activate' event in place of a custom event. I had been using that as a holdover till I had found something better, but of course I'm not familiar with the use cases in which you wouldn't want to use the activate event to let you know when a view has been put on the stage.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just depends what you want. activate will fire every time it is activated
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  6. #5
    Sencha User
    Join Date
    Nov 2013
    Location
    Los Angeles
    Posts
    26
    Answers
    1
    Vote Rating
    0
    heisenburger is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    they won't be listenable in the controller, same with erased. You can listen for it on the view and fire an event on the view for the controller to listen for it.
    Would be super cool if the docs said this