PDA

View Full Version : xtype: combo filled with live-data



blade226
15 Jul 2014, 12:42 AM
Hi,

i have a problem with a combobox in a form:



xtype: 'combo',
id: 'klientensuche',
fieldLabel: 'Klient',
minChars: 2,

store: Ext.create('Ext.data.Store', {
fields:[
{name:'id',type:'string'},
{name:'name',type:'string'},

]
,
proxy : {
type:"ajax",
url:"includes/buchungen/klient.php",
timeout: 600000,
reader:{
type:"json"
}
}
}),
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching posts found.',

getInnerTpl: function() {
return '{name}';
}
},


After the input of two characters the store loads, but the results are not displayed in the combobox.
I want to display the name and the hidden value must be id.

Someone an idea?

Sabareesh
15 Jul 2014, 2:49 AM
Have you tried the below config options

typeAhead and typeAheadDelay . Look at the docs

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.ComboBox-cfg-typeAhead

Also the valueField and displayField configs is missing

valueField : 'id'
displayField : 'name'

Thanks,
Sabareesh .

blade226
15 Jul 2014, 3:05 AM
typeAhead and typeAheadDelay doesn't work. I see just the loading bar.

skirtle
15 Jul 2014, 3:56 AM
Set the valueField and displayField and get rid of the getInnerTpl override.

If it still doesn't work post a sample of your server's JSON, it might be your reader config.

blade226
15 Jul 2014, 4:01 AM
The JSON was the problem. wrong construction of the string. Thanks for the replies and the helpful idea