View Full Version : Changing the properties of a field dynamically

19 Apr 2013, 10:55 PM
In my application's viewport i'm showing the form panel with list of fields in center region and propertygrid in east region.

I need to show the list of proiperties of the field in the propertygrid on selection of the field.
The user is able to change the properties.
Now my requirement is to apply the properties dynamically to the field.

Is there any generic way to achieve this?

Can anybody help me to achieve this?


21 Apr 2013, 9:08 AM
What properties are you looking to apply to the field? Initial configs for the formfield instance? CSS? Element attributes?

21 Apr 2013, 9:38 AM
If you want to edit the actual ExtJS properties of the field, you'll need to loop through the properties of the field (excluding functions) and put them into the property grid's store. To "dynamically change" the field itself it would probably be easiest to just destroy the field and build a new one using the new configs.

Feel free to investigate how to truly change the field dynamically, but the fastest and easiest way is to just destroy it and re-build. There are many properties you can change dynamically using the methods on the field that ExtJS provides, but not everything is easy to change on the fly.

23 Apr 2013, 11:28 PM

I want to change the properties like label, name ,height,width etc.

Can you please suggest me how to do?

23 Apr 2013, 11:31 PM

I'm not using any store for this. I just created a global object for each field which holds the properties respectively.( Here i want to set the different name as displayName for each property)

When user clicks on field i'm getting the type of filed and loading the properties to grid using setSource method of property grid.

When the user changes the dimensions of field then propertygrid should be updated with changed properties.

Can you please suggest me how can i achieve this?


24 Apr 2013, 9:12 AM
You'll likely need to set the properties of the field in the propertygrid's source yourself. Not all properties/configs can be set simply after the field is already rendered.

Once you have the propertygrid you can set many of the field properties with their setters (setTitle, setHeight, etc.).