Victor
Victor

Reputation: 17107

extjs list filter remote store

Is there a working example available of an ext js ListFilter where the list options are loaded by a remote store. The documentation gives examples of harcoded options like 'Small', 'Medium' and 'large'.

I wish to load these options from a remote store. I found one example here but this modifes the core class ListFilter.js I am looking to avoid that.
http://www.sencha.com/forum/showthread.php?64234-Ext.ux.grid.filter.ListFilter-gt-loaded-store Thanks, Kaushik

Upvotes: 1

Views: 5961

Answers (2)

Uriel
Uriel

Reputation: 464

I've created a working fiddle that could be useful for you:

https://fiddle.sencha.com/#view/editor&fiddle/2gp6

Basically you declare the filter with a store (list filter needs boths: lavel and id)

    text: 'Eye Color',
    dataIndex: 'eyeColor',
    filter: {
        type: 'list',
        store: filterStore,
        idField: 'id',
        labelField: 'value'
    }

Upvotes: 1

Joseph Lust
Joseph Lust

Reputation: 19985

Here is an example for a filter. The following code snippet would be used in the instantiation block for your filter plugin.

filters: [{
    type: 'list',
    dataIndex: 'dataInTheStoreName', // use this as the value
    single: false,   // true for radio buttons
    labelField: 'dataInTheStoreLabel', // use this as the label
    store: new yourExampleStore()
}.{...your other filters...}]

So just make an ExtJs store object to access your data, and attach it to the list filter. There are many example of this such as here.

Upvotes: 1

Related Questions