PDA

View Full Version : Config boolean type does not initialize properly



wilcosch
17 Aug 2015, 11:40 PM
In the following class definition, I would expect the test panel to be instantiated with testVar===false, except when calling the getter function it returns true.


Ext.define('Test.Panel', { extend: 'Ext.panel.Panel',


config: {
testVar: true
},


applyTestVar: function (value) {
'use strict';


console.log('apply', arguments);


return value;
},


updateTestVar: function (newVar, oldVar) {
'use strict';


console.log('update', arguments);
}
});


t = Ext.create('Test.Panel', {testVar: false});


t.getTestVar() // -> true

What am I missing here? Thanks!

joel.watson
29 Aug 2015, 9:18 AM
Hi--

You'll need to initConfig() in your component's constructor:

http://docs.sencha.com/extjs/4.2.4/#!/api/Ext.Base-method-initConfig

I hope that helps! Thanks!
Joel