PDA

View Full Version : Changes to config access



stahlman
27 Oct 2011, 3:16 AM
In previous versions, I sometimes accessed config like this:
this.someConfigProperty

This no longer works. In 4.1, it appears that any of the following would work...

1. this.getSomeConfigProperty()
2. this.config.someConfigProperty
3. this._someConfigProperty

...but I don't want to rely upon undocumented behavior (again). Method #1 is the only one I see mentioned explicitly in the docs, but for config used within methods called many times, I prefer a non-method access mechanism. Is #2 also safe?

dongryphon
28 Oct 2011, 12:34 AM
Thanks for the report. This was the result of an incorrect merge from Touch 2 and we are going to restore the 4.0 semantics for configs as best we can. The only change I expect that will carry forward is that the default config value will be set via the setter to allow it to be (potentially) transformed.

The impact of this is in the timing of the first call to the setter which might matter if your setting does things like navigate the component hierarchy (directly via ownerCt or indirectly via up/down/etc).

You should not have to resort to _foo or getFoo: using getters for all property accesses is a useless overhead and inconsistent with (most) existing config properties in Ext JS itself. If you need to revert this for your testing, you can remove the "'_'+" from "internal: '_'+name" in ext-all(-debug). Look for "registerProcessor('config', function"...

michael.piecko
28 Oct 2011, 1:35 AM
I think you meant "registerPreprocessor('config, function'".

Michael

dongryphon
28 Oct 2011, 10:02 AM
yeah... that one :)

stahlman
28 Oct 2011, 1:42 PM
Understood. Thanks. The workaround is helpful...