How can I create two combobox from one store in extjs?

extjs, extjs4.1

Solution

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.

Problem

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.

Original source