1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    71
    Vote Rating
    2
    DavidSSL is on a distinguished road

      0  

    Default What functions can be overriden and what cannot?

    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
    DavidSSL is on a distinguished road

      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
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    928
    Vote Rating
    49
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,346
    Vote Rating
    847
    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


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

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    71
    Vote Rating
    2
    DavidSSL is on a distinguished road

      0  

    Default


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

Thread Participants: 2

Tags for this Thread