PDA

View Full Version : ExtJS 3 Combo renderer unpredictable;



leduc
9 Oct 2012, 7:51 AM
Hello All,

I have a problem with my combo box.
I use displayField (for translation) and valueField. The combo.store is build from an ajax request and the value is set when I load the form. I load the valueField from the form, and I need that the combo box display the translate value.
--> That's work... But not always, sometime the combo box display the valueField and not the displayField.
If I click on combo box and change selection, all it's ok.

I test, one time on 3 (average, unpredictable), the combo box display the value field when I load the form
And in some case the valueField is not readable, it's a code for the database, so is not good for my users !!!



id : this.id + 'DTP_STATUS'
,name : 'DTP_STATUS'
,fieldLabel : MyApps.utils.translate('field_DTP_STATUS')
,xtype : 'combo'
,store : MyApps.utils.comboStore('DTP_STATUS',"config",'0')
,mode : 'local'
,displayField: 'translation'
,valueField : 'value'
,triggerAction: 'all'
,hiddenName : 'DTP_STATUS'
,typeAhead : true
,lazyRender : true
,selectOnFocus: true


This is the json that I get from server:



[["prototype","PROTOTYPE"],["production_rel","PROD_REL"],["production_work","PROD_WORK"],["in_work","IN_WORK"],["in_approval","IN_APPROVAL"],["approved","APPROVED"]]


Have you got some idea on which option I needed to add on my combo box or, if I need to add a function call on each renderer to force the good display?

Thank you in advance for your help.

leduc
9 Oct 2012, 11:42 PM
Hello,

I have advance on the subject.
In fact, the problem com from the response time of the server for both ajax request:
- form.load()
-combo.store.load().

When I render the form, several request are made and
if combo.store.load() is faster than the form.load(), the combo.box can find the translation (displayField) for the combo value send by the form.load.
If form.load() is faster than combo.store.load(); when the the value for combo box "arrive" to the combo, the translation is not present, and so, combo can not display the 'displayField'.

So, I need to look for ordering correctly the building object liste.

leduc
22 Mar 2013, 5:38 AM
I have resolved my issue:
In fact the problem come from the mode of the combo box, in my case it was not local but queryMode:




// ,mode : 'local'
,mode : 'queryMode'


Hope to help.