Results 1 to 2 of 2

Thread: initConfig and order dependencies

  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2010
    Vote Rating

    Question initConfig and order dependencies

    I am using the new style class system and trying to determine how to handle order dependencies in the object configuration processing. For example take this object:

    Ext.define('MyClass', {
       config: {
          paramA: null,
          paramB: null
       constructor: function(config) {
       applyParamA: function(value) {
          b = this.getParamB();
          return doWork(b);
       applyParamB: function(value) {
          return doSomething(value);
    I have two configuration parameters. Param B initializes itself based upon some computation internal to the class. Param A needs to initialize itself but needs to use the initialized value of param B as part of this computation.

    This creates an order dependency inside the initialization performed by initConfig. Namely param B must be initialized first so it is available for Param A to be initialized.

    My question is, how do I handle this in my application. Is there some way to specify this? Does the class system try to automatically solve for these cases?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    The apply methods will fire in the order you place them in the config object.

    So if you have

    config : {
        paramA : true,
        paramB : true
    Then applyParamA will fire before applyParamB. However if you have

    config : {
        paramB : true,
        paramA : true
    Then applyParamB will fire before applyParamA
    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

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    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.

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