1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    11
    Vote Rating
    0
    cdamon is on a distinguished road

      0  

    Default Unanswered: Ext.create, constructors, and config

    Unanswered: Ext.create, constructors, and config


    Apologies if this has come up before. I'm fairly new to ST, but I feel I'm beginning to get it. The concept of configurations that automatically generate getters and setters (plus the apply and update functions) is useful and important.

    That's why I'm a bit surprised that the following doesn't work:

    Ext.define('MyApp.MyClass', {
    config: {
    foo: null,
    bar: null
    }
    });
    Ext.create('MyApp.MyClass', { foo: 'a', bar: 'b' });

    I would expect the object to be initialized with those values for 'foo' and 'bar'. Following the code, I see that it just calls the 'new' operator, passing the appropriate number of arguments.

    My guess is that config isn't handled because you can't be sure it's a config - it's just a single argument that happens to be an object. If that's the case, maybe passing a single argument that happens to be an object with only a single property of 'config' could trigger it.

    As it is, I end up writing trivial constructors like this:

    constructor: function(foo, bar) {
    this.setFoo(foo);
    this.setBar(bar);
    }

    Is there something I'm missing?

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    411
    Answers
    5
    Vote Rating
    17
    jweber will become famous soon enough

      0  

    Default


    You need to call initConfig:

    Code:
    constructor: function(config) {
    	this.initConfig(config);
    }

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    11
    Vote Rating
    0
    cdamon is on a distinguished road

      0  

    Default


    Ah, missed that somehow. Thanks!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi