Results 1 to 5 of 5

Thread: What functions can be overriden and what cannot?

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    71
    Vote Rating
    2
      0  

    Default What functions can be overriden and what cannot?

    As part of another problem, I've come across another issue. Effectively, I'm trying to override the LoadMask.

    In order to help this discussion, here's an excerpt of the Ext.LoadMask class:

    Code:
    Ext.define('Ext.LoadMask', {
        // private
        onLoad : function() {
            var me = this;
    
    
            me.loading = false;
            me.el.unmask();
            me.fireEvent('hide', me, me.el, me.store);
        },
    
    
     
        /**
         * Hide this LoadMask.
         */
        hide: function() {
            this.onLoad();
        },
      
    });
    Notice how hide is calling the "private" method onLoad. Now here is my override:

    Code:
    Ext.override(Ext.LoadMask, {
    
    
        hide: function () {
            this.callOverridden();
    
    
            console.log('hide executed');
        }
        , onLoad: function () {
            this.callOverridden();
            console.log('onLoad executed');
        }
    });
    The result is that 'onLoad executed' while 'hide executed' doesn't get shown in firebug's console window. Hence, the first question is why is this happening? The next question is what can I override and what can't I override?

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    71
    Vote Rating
    2
      0  

    Default

    Ah stupid question. Basically, it's to do with the fact that hide is never called in code while onLoad is.

    However, another question that arises from here is how is this onLoad getting called?

  3. #3
    Sencha Premium User westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,019
    Vote Rating
    107
      0  

    Default

    Quote Originally Posted by DavidSSL View Post
    However, another question that arises from here is how is this onLoad getting called?
    Probably by an event handler setup in LoadMask's bindStore.
    Product Architect
    Altus Ltd.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    Ext.LoadMask adds listeners to the load and exception events on the store. Also, if the LoadMask is disabled while loading, it will call onLoad (no listener).
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    71
    Vote Rating
    2
      0  

    Default

    Thank you Mitchell and Westy. You've certainly answered my question.

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
  •