Wednesday 15 July 2015

config - Extjs configoptions vs properties -


There are properties and properties by adding those properties to a Java class. An ExtJS class has properties, methods and configOptions .
Conceptually, what is the difference between the configOptions and the properties? Why do we need both?

According to my understanding ...

Config - The constructor has defined, which defines the behavior of the class, the configuration should not be changed at run-time because it will have no effect, suppose you need to specify a title for the panel , Then you can add a configuration example {title: 'some title'} to use the panel's title time Used to set Nder time, but then, if you try to change the title, you can not change the property changed easily to the configuration options.

Properties - Used to store useful information for that class, it is usually not passed through the constructor, but it does not pass the recipient and setter methods You should change the property at run-time (if the setter method is defined) and class objects should detect this change, only properties can be read, which can be read by class objects. Modified, we should not just change all this.

More info

My answer to this question is a bit simpler and idealistic I am afraid that to give a complete answer , In which all the nuances are included, instead of clarifying the situation there is more chance of adding confusion.

Configuration objects are used to configure objects when trying to set them as property on the object when it is created, there will often be no effect.

  Ext.create ('Ext .panel.Panel', {// configuration options go here}};   

An object has many properties but only those people listed in the properties section should be considered public property. Although you have nothing to prevent from reaching private property, It should be done only in the form of the last resort, where there is probably a method of documenting them to manipulate Try to use.

  // is a public property presented to indicate whether the panel was provided If (panel.rendered) {// can be in the panel panel but this is not a public property, use getEl instead varel = panel.getEl (); ...}   

The only reason is that the lines are blurred, that the object is usually a copy of your configurations Award the copy you are:

  Ext.apply (This, config);   

This is the result of at least initially becoming a personal property in all configuration options, internally classes can manipulate those properties appropriately but externally Accessing properties violates encapsulation and should be avoided.

No comments:

Post a Comment