Results 1 to 5 of 5

Thread: Not catching the initialize and painted event

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    162
    Answers
    7
    Vote Rating
    2
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    Just depends what you want. activate will fire every time it is activated
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •