PDA

View Full Version : Sencha 3.X Form, Combobox from JSON Store



RobTucker11
16 Apr 2011, 9:54 AM
I have an issue where comboboxes randomly display the valueField instead of the displayField.
What is the best practice way of loading a jsonstore into a combobox?

I've got comboboxes being populated from jsonstores in a standard form as follows:



var franchiseStore = new Ext.data.JsonStore({
url: '/administration/franchisesjson/',
root: 'data',
autoLoad: false,
mode: 'local',
successProperty:'success',
idProperty:'id',
fields: ['franchise_id','franchise_name']
});
franchiseStore.load();

new Ext.form.ComboBox({
fieldLabel: 'Franchise',
hiddenName:'franchise_id',
store: franchiseStore,
valueField: 'franchise_id',
displayField: 'franchise_name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Please select a franchise...',
selectOnFocus:true,
width: 330
}),



I then load the form as follows:



tab2.getForm().load({url:'/administration/getclient/' + client_id} );