PDA

View Full Version : Combobox remote loading problem



ivan r
12 Apr 2011, 1:34 AM
Hi everybody,

I'm a newbie and I'm trying to fill a combo with values depending by a parameter.
I'm able to load the store but the combo doesn't work.

Please, could somebody tell me why doesn't work?

here my code:

//store
var comboStore = new Ext.data.JsonStore({
url:'/process/EMBrowser/site/counter/entries/process.parameterentries.php',
totalProperty: "totalcount",
root: 'values',
fields: [
{name:'uid', type:"string"},
{name:'name', type : "string"}]
});

//combo
var comboBox20 = new Ext.form.ComboBox({
xtype:'combo'
,id: 'comboBox20'
,name:'comboBox20'
,fieldLabel:'Valeur'
,mode: 'remote'
,displayField: 'name'
,triggerAction: 'query'
,selectOnFocus: true
,forceSelection: true
,editable: false
,valueField: 'uid'
,emptyText:"select..."
,store:comboStore
});


fillCombo: function(parameter_id){
Ext.getCmp('comboBox20').store.load({
url:this.url
,waitMsg:'Loading...'
,params:{cmd:'fill',parameter_id: parameter_id}
});
}

This the Json i receive:
{"totalcount":6,"values":[{"uid":"1","name":"no.stars"},
{"uid":"2","name":"one.stars"},{"uid":"3","name":"two.stars"},
{"uid":"4","name":"tree.stars"},{"uid":"5","name":"four.stars"},
{"uid":"6","name":"five.stars"}]}