PDA

View Full Version : ComboBox Initial Population Question



jhoweaa
30 Jul 2009, 10:33 AM
I'm using a remote combo box with the type ahead capability. As a user types in characters, a query is sent to the combo box store which retrieves a list of values starting with the characters entered. This all works perfectly. I have a dialog which uses this sort of combo box. The user types in a string and the store comes back with a Name and a Code. The user sees the name but it is the code which gets stored. When the user is creating 'new' items, the dialog works fine and properly saves data.

The problem (and my question) comes when I try to edit this information. I retrieve a record from my database and populate the dialog with information from the record. When the combo box is displayed, it shows the Code and not the name. The query code on the server side will return the proper name if a code is used as the search param, but when the combo box is first displayed, no query is sent. What is the proper way to get the combo box to display the proper value?

Thanks!

Condor
30 Jul 2009, 1:48 PM
There are several solutions.

If you know the display text when setting the value you can use:

combobox.valueNotFoundText = 'New text';
combobox.setValue(newValue);
delete combobox.valueNotFoundText;

Another solution could be this (http://extjs.com/forum/showthread.php?p=364333) (although that propbably doesn't work with triggerAction:'query').