How can I add two comboboxes from one store store have type
field witch values can be 1, 2 and 3
I want records with type 1 and 2
in first combobox and 2 and 3
in second.
My ComboBox:
Ext.define('Exp.view.settings.servers.ComboBox', {
extend: 'Ext.form.ComboBox',
alias : 'widget.server_combobox',
xtype: 'combobox',
displayField: 'name',
valueField: 'id',
name: 'server',
store: 'Servers'
});
Store: (just example data from server with json reader)
Ext.define('Exp.store.Servers', {
extend: 'Ext.data.Store',
model: 'Exp.model.Server',
autoLoad: true,
autoSync: true,
data: [{
id: 1,
name: 'Server 1',
type: 1
},{
id: 2,
name: 'Server 2',
type: 3
},{
id: 3,
name: 'Server 3',
type: 2
}]
});
If I go with store filter both comboboxes goes filtered. For now I created two stores but that means two ajax calls to server and I don't really like that.
The answer is no, you can not. If you need to have two different sets of data from the same store to be reflected in any two UI elements at the same time (two grids or two combos or whatever) you need to create a copy of your store.
You can either clone it or even create more simple model (comboboxes need just value and name for example) but there is no way around it.
I think filter will be cleanest way. it's just local example. Didn't used app structure. http://jsfiddle.net/ssxenon01/WpZMU/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With