PDA

View Full Version : Binding Ext.data.JsonStore to linked comboboxes



sande0005
9 Feb 2014, 12:47 AM
I am new to extJS. I have 2 comboboxes which is binded witha common data store.
Below is the store -


comboStore = new Ext.data.JsonStore({
url: 'Getvalues',
root: 'rows',
autoLoad: true,
fields: ['Type', 'TypeDetails']
});

Here `Type` is a string and `TypeDetails` is an array list having field `Description`. A single `Type` can have multiple `Description`.

My requirement is, I have to bind one combobox with `Type` and when ever I select a `Type` only `Description` of curresponding `Type` should be binded with combobox 2.

I have tried -


xtype: 'combo',
id: 'cmbType',
editable: true,
typeAhead: true,
allowBlank: false,
displayField: 'Type',
valueField: 'Type',
hiddenName: 'Type',
store: comboStore,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
emptyText: 'Select Type'
, listeners: {
select: function (cmb, record, index) {

}
}




xtype: 'combo',
id: 'cmbDesc',
editable: true,
typeAhead: true,
allowBlank: false,
displayField: 'Description',
valueField: 'Description',
hiddenName: 'Description',
store: comboStore,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
emptyText: 'Select Type first'


What should I do in combo1 `select`?
I am using extJS 3.4

mitchellsimoens
11 Feb 2014, 1:24 PM
So you want to replace the data of the 2nd store with an array from the selected record from the first store?