PDA

View Full Version : What is the difference between a property and a configuration option?



extjsnb
27 Jul 2011, 10:58 AM
Hello,

I'm a newbie to extjs and for design purposes, I am trying to understand the difference between a property and a configuration option. Can properties be inherited by a subclass from its base class?

Thanks in advance...I appreciate it!

dawesi
28 Jul 2011, 5:28 PM
I'll give it a stab...


config overrides the configurable properties of the current instance

properties belong to the prototype of the class, so changes effect all the other instances of that class.

edspencer
29 Jul 2011, 4:38 PM
Yeah that's basically it. In 4.x we've added a really powerful new configuration system as part of the new Class system architecture but haven't migrated everything to it yet (as of 4.0). Everything using that system is configurable at runtime; the properties are just references to objects used internally by the class and generally aren't developer/user configurable

phamtranquocviet
10 Feb 2012, 8:25 AM
Could you please give an example to demo this difference? I tried the following, and only the first button is hidden. Since hidden is a property, I was expecting Login2 and Login3 to be hidden too. Pardon me if I am not correct as I am a newbie too.

initComponent: function() {
Ext.getBody().mask("Loading...");
this.items = [
......
this.buttons = [
{
text: 'Login1',
action: 'login',
hidden: true
},
{
text: 'Login2',
action: 'login'
},
{
text: 'Login3',
action: 'login
}
];

this.callParent(arguments);
Ext.getBody().unmask();
}

vietits
10 Feb 2012, 4:07 PM
Ext.button.Button defines that each object instantiated from it has property hidden with default value set to false.

With button 'Login1', you set hidden config to be true, this will override default setting of hidden property so this button will be hidden.

With two rest buttons, you don't set their hidden configs so they will have default value (false) and they will display.



initComponent: function() {
Ext.getBody().mask("Loading...");
this.items = [
......
this.buttons = [{
text: 'Login1',
action: 'login',
hidden: true
},{
text: 'Login2',
action: 'login'
},{
text: 'Login3',
action: 'login
}];


this.callParent(arguments);
Ext.getBody().unmask();
}