PDA

View Full Version : Textarea and triggerField in Ext 4.1?



hshu
4 Sep 2012, 6:18 PM
Hello guys,
I want to make a textarea with a triggerField. But since triggerField extends from textfield, it is not easy to do. In Ext 2, there was a "defaultAutoCreate" config I could override and change the textfield into a textarea.

But how to do this in Ext 4.1? The only way I see is to create my custom triggerField class so that it extends from textarea.

Also, instead of extending from textarea, another alternative would be to somehow make a textfield display multiple lines, but I can't figure that out. ('\n' and '<br/>' won't work)

Thoughts? Thanks in advance!

scottmartin
5 Sep 2012, 7:43 AM
What would happen after the trigger .. update the current line? You could always create a container with a button in a hbox layout ...

Also .. Both triggerfield and textarea extend from textfield. You could create your own widget.

Scott.

hshu
6 Sep 2012, 6:40 AM
Hi Scott,
Thank you for your reply!
The trigger will open up something like a to-do list (one thing each line).
I don't want all my to-do things to be in a single line, that's why I need a textarea.

Currently, my solution is to create my custom triggerTextArea class. It copies all the source code of Ext.form.trigger. The only difference is that it extends from Ext.form.TextArea.
So this solution is not a good way of code reusing (too much duplicate code.)
Is there a better way?

Also can you elaborate on "a container with a button in a hbox layout" ?