Rick Weller
Rick Weller

Reputation: 1258

filter option in a grid

i use a filter option in a grid where i can select per column what i want to filter. For the options i need to do this:

Ext.ux.ajax.SimManager.init({
    delay: 300,
    defaultSimlet: null
}).register({
    'filterEvents': {
        data: [
            ['Dag 1', 'Dag 1'],
            ['Dag 2', 'Dag 2']
        ],
        stype: 'json'
    }
});

 dagenFilter = Ext.create('Ext.data.Store', {
     fields: ['id', 'text'],
    proxy: {
        type: 'ajax',
        url: 'filterEvents',
        reader: 'array'
    }
});

But because the filter options need to be dynamic and not static i want to load the options from a service. The output of that json looks like this

{
"dagen": [{
    "name": "Dag 1",
    "reference": "Dag 1"
}, {
    "name": "Dag 2",
    "reference": "Dag 2"
}, {
    "name": "Dag 3",
    "reference": "Dag 3"
}, {
    "name": "Dag 4",
    "reference": "Dag 4"
}]

}

but i am not sure how to do this.

Upvotes: 0

Views: 1407

Answers (1)

egerardus
egerardus

Reputation: 11486

If by "filter option in a grid" you are referring to FiltersFeature the answer is easy. A ListFilter can be backed by a DataStore.

Take a look at the options config of ListFilter here. Specifically, store and phpMode might also be relavant. Here is an example of one:

{
    header: 'List Filter Column',
    dataIndex: 'list_data',
    width: 120,
    filter: {
        type: 'list',
        store: Ext.getStore('FilterOptions'),
        phpMode: true
    }
}

Upvotes: 3

Related Questions