How can I inject a store into a panel's toolbar?

67 Views Asked by At

My app uses Deft to inject stores. However, when I try to inject a store into a pagingtoolbar at the bottom of a grid panel, it does not work.

Ext.define("My.grid.Panel", {
    ...
    inject: {
        store: 'myStore' // works fine
    },
    ...
    dockedItems:[{
        xtype: 'pagingtoolbar',
        ...
        inject: {
            store: 'myStore' // does not work
        }
    ]
}

My current workaround is adding this to the panel:

listeners: {
    afterrender: function(panel) {
        let toolbar = panel.down('pagingtoolbar');
        if (toolbar) {
            toolbar.setStore(panel.getStore());
        }
    }
}
1

There are 1 best solutions below

0
anonymouse On BEST ANSWER

We ended up just creating a separate class that extended PagingToolbar. This solved the problem as Deft was then able to inject into it.