View Full Version : How to display combobox value in a textfield?

29 Nov 2011, 8:10 AM
Hi, I am still new to ExtJs. There is a question using combobox and textfield.

I have some data in the database. They were set by a combobox in the admin page. In some circumstances, I will need to display a this information based on the database. It has to be read only. How can I do that? If I make it a combobox, the user will be able to edit its content. If I disable the combobox, it becomes grey out. If I make it a textfield, it will become the id of the value.

29 Nov 2011, 8:18 AM
Perhaps a read-only combobox?


However, this will still present the data like a field and if it really isn't editable this might not make sense. The alternative is just to look up the value in the store and grab the display field from the record. You can then put that value on screen however you want.

29 Nov 2011, 8:24 AM
Actually I find a config called hideTrigger
By setting it to true, I can make a combobox looks like a textfield.

Thanks anyway!

29 Nov 2011, 8:41 AM
Hiding the trigger won't stop them being able to edit the value. Setting readOnly: true also hides the trigger.

29 Nov 2011, 11:46 AM
Ya that too.

That gave me what I want