Search code examples
extjsextjs3

Ext JS - Preconfigure Grid's Store with a filter


I'm trying to reuse a grid under different tabs.

Is there a way I can have one centralized store for that grid and show data under different tabs based on a filter? In other words, can I add a store to a grid with a data filter via designer / in the event handler.

I'm using Ext JS: 3.4 (if it helps)

Here is a snapshot of what I'm looking for.

enter image description here


Solution

  • You can probably create 4 grids, linked to a single store.

    Then you will have to listen to the tabchange event ( http://docs.sencha.com/ext-js/3-4/#!/api/Ext.TabPanel-event-tabchange ), figure out which tab you've selected (http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Panel-method-getComponent ), then filter your store again based on which tab you are using. (http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-filter )