Results 1 to 3 of 3

Thread: How are you supposed to use initConfig?

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Huntsville
    Posts
    252
    Answers
    7

    Default How are you supposed to use initConfig?

    The docs for initConfig are quite confusing. When I look at the code below, it looks like I'm overriding constructor, but instead of doing this.callParent, I'm calling initConfig.

    I'm trying to see what is creating a store in my app. There is no explicit creation of the store, yet I see the proxy making a request for data. I'm trying to figure out how this is happening. I was going to attack the problem by overriding initComponent, but DBStores are evidently not components. They have this initConfig, but the docs for initConfig raise more questions than they answer.

    http://docs.sencha.com/extjs/4.2.2/#...hod-initConfig

    Code:
    Ext.define('My.awesome.Class', {
        // The default config
        config: {
            name: 'Awesome',
            isAwesome: true
        },
    
    
        constructor: function(config) {
            this.initConfig(config);
        }
    });
    
    
    var awesome = new My.awesome.Class({
        name: 'Super Awesome'
    });
    
    
    alert(awesome.getName()); // 'Super Awesome'
    Looks to me like the docs are flawed. By throwing in a debugger; statement, it looks like you need to change the constructor call to at least be

    Code:
        constructor: function(config) {
            return this.initConfig(config);
        }
    since the default constructor is
    Code:
        constructor: function(config) {
            return this;
        }
    and without it
    Code:
    x = Ext.create(....)
    would not assign anything.

    Also seems that if you follow the docs, the object is not correctly constructed. In the case of a store, the store is NOT added to the StoreManager.

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    Hi,

    If you're working with a store you won't need to call initConfig directly (most classes you'll work with call that internally for you).


  3. #3
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    707
    Answers
    25

    Default

    Mark, are you still working on this?

    Did you look for a proxy on a model? Put some breakpoints in the Store code? Look at what stores are registered?

    Code:
    console.dir(Ext.StoreManager.getRange());

Posting Permissions

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