View Full Version : How to empty initialConfig?

16 Mar 2012, 8:33 AM
Hello - first post, new to ExtJS but am loving it so far :)

Well on to my problem...

I need to update initialConfig on a wide variety of components based on a new initialConfig that I get from a treepanel rootnode (by running it through a function that re-creates a new initialConfig object for me).

If I go into the initialConfig object directly in any way it will not work for my purpose, so I use apply like so...

Ext.apply(toBeUpdated.initialConfig, newInitialConfig);

But if my newInitialConfig has certain properties deleted that the original has, then there is my problem - apply only overwrites and adds, and as mentioned if I just set it to an empty object then I will get an error when re-rendering the component - so toBeUpdated.initialConfig = {} wont work...

Can't seem to find a way to empty the toBeUpdated.initialConfig, and going through the object with a recursive function to deal with this seems not to be the way.

Hope to be enlightened that there is indeed a "Ext" way around this problem (and that my question is not totally stupid :))

16 Mar 2012, 11:51 AM
So you only want to have what is in the newInitialConfig?

16 Mar 2012, 2:24 PM

but it is important that it is done the ext way (in case I change the initial config of a nested component so the root components initialconfig is updated for the component I alter)

16 Mar 2012, 8:58 PM
When creating the component try using clone


26 Mar 2012, 2:03 AM
Just to follow up on my problem.

Only way I could get it to work was to iterate through each property in initialConfig and then delete em.

Only way I could get it to work....