0

If a function is defined inside the config object that is passed to Ext.application(), is there a way to override this function definition. Also, another point to note is that application is created inside Ext.onReady(function(){...

Here is an example

Ext.onReady(function() {
    Ext.application({

        name: 'TestApplication',

        customFunction: function(obj) {
            //Some function definition.. .. .. 
        }
        });

        launch: function() { window.appl = this; }


        ... 

        });

This code is from a js file that I can't change and I need to override the definition of customFunction from another js file that loads later in the sequence.

The only way I'm able to achieve this is using Ext.onReady in my file as well.

Ext.onReady(function() {
  appl.customFunction = function (obj) {
        //My own definition
    }
});

Now my question is, is this a proper way to do this? Or is there a better/elegant way? Is it OK to have multiple Ext.onReady functions in the code?

Varun
  • 1,014
  • 8
  • 23
  • 1
    u can do it just like you specified, but if timing of execution is wrong, you may need to go another route. – dbrin Jul 01 '14 at 20:04
  • Thanks. It works for me as of now. I'm just wondering if there is another way. Can you elaborate on the another route if possible please? – Varun Jul 02 '14 at 06:52
  • You might find this helpfull [best practice for overriding classes properties in extjs](http://stackoverflow.com/questions/14254321/best-practice-for-overriding-classes-properties-in-extjs/14254627#14254627) – sra Jul 02 '14 at 08:27

0 Answers0