combobox.loadRecord() , MVC and Direct
I cannot find the solution to a "simple" problem with a remote combobox.
Long story short, I'm not able to show the displayField of the combobox using form.loadRecord().
The problem is that the combobox store is not loaded when I call loadRecord().
If I load it before setting the value, I should download the whole store to be sure that the value I'm looking for is downloaded.
This is the scenario:
Two objects involved: User, Street (User hasOne Street).
Both models configured with a Direct proxy, both stores with autoLoad: false
Both stores are also used in other parts of the application.
The street combobox has queryMode: false, valueField: street_id and displayField: street_name
The combobox store has autoLoad: false
When I edit a User, I create a form with a Street combobox. The combobox has name: street_id (this is the value I need to save to the database).
I call loadRecord() and the combobox display the street_id (as the street store is not loaded).
If I apply this override http://blog.oomta.com/extjs-4-combob...oading-models/ , the store is populated with 50 streets, but, as streets are more than 1000, it is quite sure that I will not get the record I'm looking for to decode street_id to street_name.
I also have street_name in the User model. So, I could set both street_id and street_name with the data I have in the User record.
But I cannot find the way to set the "displayValue" (street_name) of the combobox, while keeping the value (street_id) unchanged.
How comboboxes are intended to work with big data?
Thank you very much for you help
Since you already know the value of the record you want to find, perhaps you could call doQuery on the combo *after* the loadRecord(), sending through the display value as the query.
As you know your value will be in the query result, the value of the combo which has already been sent will be found in the result list and then displayed as the "selected" value.
Thank you very much for your help!
It works very well
Tags for this Thread