1. #1
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    2
    Vote Rating
    0
    starkgray is on a distinguished road

      0  

    Default Application of Grid and Store filtering

    Application of Grid and Store filtering


    My website processes a continuously updating stream of JSON - In an effort to keep traffic at a minimum I'd like to maintain a store of updates that is used for more than one grid. Currently, as updates come in, the affected rows are updated in an Ext.data.Store with a JSON reader. The store is bound to an Ext.grid.GridPanel and Ext.DataView panel.

    The problem comes in when I try to create a second GridPanel from the same store (but filtered). Any filtering applied to one grid results in modifying the other. I've researched 2 types of filtering:
    1.) Use plugin for GridFilters
    http://dev.sencha.com/deploy/dev/exa...id.GridFilters

    As an example, I modified the grid-filtering example grid-filter-local.js and added my own button to apply a custom filter:

    Code:
            
    1. handler: function () {
    2. grid.filters.clearFilters(); //for some reason, this is required first to set the filter programatically
    3. grid.filters.addFilter({ "dataIndex": "company", "type": "string", "value": "w"});
    4. }

    Creating a second grid panel and column model, but bound to the same store will end up applying filters and sorting to both grids


    2.) Apply filter on store

    Code:
    myStore.filter('company', 'w', true, true);
    Again, any grids using this store get filtered.

    Do I have to create a copy of the store to apply different filtering? Should I be looking at some other Ext data structure?

    Any help is much appreciated,
    starkgray

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Correct, a store filter applies to all linked components, so if you want to display some components with all data and some with filtered data, you will need two stores.

Similar Threads

  1. sencha touch application for the iphone / android application store
    By wpichler in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 31 Aug 2010, 6:17 AM
  2. Filtering store using combobox or Textfield and show it in the grid
    By paweluz in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 16 Jun 2010, 12:34 AM
  3. Grid's store filtering question.
    By dreamcaster in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 13 Dec 2009, 8:02 PM
  4. Grid/Store filtering
    By CJPartridge in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 23 Mar 2009, 4:40 PM

Thread Participants: 1

Tags for this Thread