PDA

View Full Version : EditorField, or something to dynamically changed field widget?



ajmas
10 Aug 2010, 10:32 AM
I have a form in which the value field should display the appropriate input editor (date, text, number, etc), based on the data type corresponding property name selected from a preceding combo-box. For this reason I am looking into a suitable approach for doing this, while maintaining the form presentation.

One thing that I tried was removing the last element and then replacing it with something else, but that doesn't seem to work too well. Some other approaches I am looking at:
- creating my own field that somehow wraps the editors and then display the appropriate one
- seeing how GridEditor works and see if I adapt it

If anyone has a working solution, or any suggestion, they would be appreciated.

aconran
12 Aug 2010, 3:02 PM
Why not just have a class that maintains a number of different Editors that wrap different types of fields and then show the approriate one?

ajmas
13 Aug 2010, 5:50 AM
Why not just have a class that maintains a number of different Editors that wrap different types of fields and then show the approriate one?

I had considered that, but I wasn't sure whether I should be inheriting from any specific ExtJS class, so that it gets laied out properly in the form (including label). I had considered using the Field class, but was not sure whether I could embed another field in it, or a Panel.