DropMania
DropMania

Reputation: 133

ExtJS 6 Filter Combobox Dropdownmenu with a remote store

I have a remote store like this:

 example:{
        storeId: 'example',
        fields: ['field1','field2','field3'],
        proxy:{
            type: 'ajax',
            url: 'data.cfc',
            actionMethods: { read: 'POST' },
            reader: {
                type: 'json',            
            }
        }                       
    }

And my Combobox looks like this:

 xtype: 'combo',
 fieldLabel: 'Example',
 name: 'Example',
 bind:{
    store: '{example}'
 },
 valueField: 'field1',
 displayField: 'field2',
 forceSelection: true,

My Problem now is that with a remote store the combobox doesn't filter the values in the Dropdownmenu like queryMode: 'local', when I type something in the textfield. Is there a way to achive the same filter appearance with queryMode: 'remote'?

Upvotes: 0

Views: 879

Answers (1)

xhadon
xhadon

Reputation: 876

You won't be able to reproduce the exact same behaviour with a remote store (because you have to load the data first). If you don't mind loading the store on creation, you can configure your store accordingly to allow querying locally again:

autoLoad:true
remoteFilter: false,

autoLoad: true ensures that the store is loaded on creation. remoteFilter: true is necessary if you're trying to use the local querymode for a combobox with a remote store.

Then you only have to add this property to your combobox

queryMode: 'local'

to filter the fetched data. This may not be a good idea if you're loading huge amount of records to your store. In addition, you'd have to implement a function to (re)load the store on demand.

See this fiddle for an example.

Upvotes: 1

Related Questions