PDA

View Full Version : 4.1 Ext.DirectStore combo box problem



paulr88
19 Jun 2012, 3:12 PM
I have a problem whereas I can not get a combo box to load data via a RPC (Direct) source. I have a form with tons of combo boxes and Direct/RPC over Rest is faster since it batches.

I have read, what I believe to be all the related forum posts but can not get it to work in 4.1

The rpc function is called.. but the load event is never fired and the combo box is never filled. Please not e this is the latest and not the cleanest combobox / store config.

Is anyone using a combobox filled by a directProxy BTW.. this works with a rest proxy just fine.

The current iteration



Ext.create('Ext.form.ComboBox',{
fieldLabel: "Country",
editable: false,
triggerAction: 'all',
mode: 'remote',
renderTo:Ext.getBody(),
store: new Ext.data.DirectStore({
proxy: {
type: 'direct',
directFn: module.isightserver.rpc.getData,
extraParams: {
model: 'country',
val: null,
field: null,
activeOnly: null,
expand: null
}
},
listeners: {
load: function() { alert('loaded'); }
} ,
reader: new Ext.data.JsonReader({


successProperty: 'success',
idProperty: 'id',
root: 'data',
fields: [
{name: 'id', type: 'string'},
{name: 'value', type: 'string'},
{name: 'lower', type: 'string'},
{name: 'upper', type: 'string'},
{name: 'label', type: 'string'},
{name: 'demonym', type: 'string'},
{name: 'person', type: 'string'},
{name: 'masculin', type: 'string'},
{name: 'feminine', type: 'string'},
{name: 'people', type: 'string'},
{name: 'active', type: 'int'},
{name: 'created_at', type: 'date'},
{name: 'updated_at', type: 'date'}
]
}),
autoLoad: true
}),
valueField: 'id',
displayField: 'label'
});



The application/json response



{"type":"rpc","tid":2,"action":"rpc","method":"getData","result":{"success":true,"total":249,"data":[{"id":"AD","value":"Andorra","lower":"andorra","upper":"ANDORRA","label":"Andorra","demonym":"Andorran","person":"Andorran","masculine":"Andorran","feminine":"Andorran","people":"Andorrans","active":"1","created_at":"1335994280","updated_at":"1335994280"},{"id":"AE","value":"United Arab Emirates","lower":"united arab emirates","upper":"UNITED ARAB EMIRATES","label":"United Arab Emirates","demonym":"Emirati","person":"Emirati","masculine":"Emirati","feminine":"Emirati","people":"Emiratis","active":"1","created_at":"1335994295","updated_at":"1335994295"}]}}