View Full Version : ComboBox with remote JsonStore not showing displayValue

12 Nov 2009, 8:10 AM
I have a ComboBox with a remote JsonStore (autoload: true).
When i give the ComboBox a value it just shows the value and not the displayValue.
I also noted that the store fetches it's data twice.
Once when i open the form, a second time when i open the ComboBox

new Ext.form.ComboBox({
id: 'ExtId141',
fieldLabel: 'Bedrijf',
name: 'company_id',
margins: '5 5 5 5',
allowBlank: false,
msgTarget: 'qtip',
anchor: '-4',
value: '4',
editable: false,
forceSelection: true,
minChars: 0,
queryParam: '-1',
valueField: 'id',
displayField: 'company',
hiddenName: 'company_id',
mode: 'remote',
store: new Ext.data.JsonStore({
storeId: 'ExtId142',
root: 'items',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id'
name: 'company'
proxy: new Ext.data.HttpProxy({
url: '/dataManager/list/company'
listeners: {
loadexception: function (a, request, response, error) {
if (Ext.decode(response.responseText).msg) {
errorMessage = Ext.decode(response.responseText).msg;
} else {
errorMessage = error.message;
Ext.MessageBox.alert('Error', errorMessage);

sortInfo: {
field: 'company',
direction: 'ASC'
autoLoad: true,

I found this thread which does offer a solution, however now the data gets fetched 3 times.
2 times on form load, 1 when you open up the ComboBox.

Does anybody have a solution that doesn't involve loading in the SAME data multiple times?

Thanks in advance!

12 Nov 2009, 8:33 AM
I think you should remove the autoLoad: true... unless it's used somehow (you also have an extra comma after that which would be invalid)

The data will be loaded on the trigger event.

Also, why are you using a proxy for the JsonStore? I'd just include the url config option in the JsonStore itself.

Perhaps add a triggerAction: 'all' too, to the ComboBox.

12 Nov 2009, 10:13 AM
Right, so i turned autoLoad off and added triggerAction: 'all' to the ComboBox.
This did cut back the amount of data requests to one, however it didn't load the data when i show the form.
I need to manually open the ComboBox before it fetches it data.
And obviously without the data it can't show a proper displayValue.

Regarding the proxy, good question.
Must have picked that up somewhere and never bothered to look into it.
It's now setting the url directly, thanks for the tip.

12 Nov 2009, 10:23 AM
Try lazyInit: false
It defaults to true.

12 Nov 2009, 10:48 AM
Same result as before, store doesn't get loaded until i open it manually.

12 Nov 2009, 11:11 AM
You try lazyInit with autoLoad: true?

12 Nov 2009, 11:14 AM
That does load the store data on form load, but still doesn't set the proper displayValue

12 Nov 2009, 11:45 AM
Have you tried setting the value after the store is loaded on the first time?

13 Nov 2009, 9:53 AM
I'll have a go at that, thanks so far.
In the mean time, if anyone has any suggestion keep 'm coming, all advice / help is welcome.