Search code examples
javascriptextjsbindingviewmodelstore

bind a store to a list filter in extjs 5


I am using extjs 5 on web app using sencha CMD layout (mvvm) and would like to bind a store (for labels) to filter list in my view grid the viewModel store definition is:

 stores: {
    labelContacts: {
        model: 'myapp.model.label.Contact'
        , autoLoad: true
    } // end contact store
 } // end stores

and my list filter code in view grid

filter: {
                type: 'list',
                bind: {store: '{labelContacts}'}
                labelField: 'DisplayValue',
                valueField: 'keyId'
        }

the filter works but it doesn't show data from the bound store but creates it's own from the grid's store

am I missing some thing?


Solution

  • I found a workaround to get the bound store but I am not satisfied by the solution as it's not really an elegant one, and would be glad to hear any suggestions my solution was changing the store to:

    filter: {
        type: 'list',
        store:new myapp.view.main.MainModel().getStore('labelContacts'),
        labelField: 'label',
        valueField: 'id'
    }