PDA

View Full Version : Ext Class system config block and $configstrict



fdp
23 Feb 2015, 9:32 AM
I have this simple code:



Ext.define('Man', {
config: {
name: 'unknown'
},
constructor: function(config) {
console.log('Man constructor');
this.initConfig(config); // will call initConfig
return this;
}
});


var bob = Ext.create('Man', {
name: 'Bob',
age: 1 // not in class config
})


console.log(bob.getName()); // it prints Bob
console.log(bob.name); // it prints undefined, why? it should print 'unknown'
console.log(bob.age); // it prints 1, why? with $configStrict:true should be removed?


im2

The question is:

Why initConfig copies also properties that are missing in the config class but are passed as the create method argument?

With $configStrict true I expect that properties not defined in the config block should not copied in the instance

Is there any way to get this behaviour?

Thanks.