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

How can I add two combobox from one store, I have values typethat can be 1, 2 and 3. I want records with a type 1 and 2in the first combo box and 2 and 3in the 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'
});

Save: (just sample data from the server using 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 a storage filter, then both comboboxes will be filtered out. At the moment I have created two stores, but this means two ajax calls to the server, and I do not really like it.

+3
source share
2 answers

- , . , ( - ), .

, (comboboxes , ), .

+6

All Articles