Multiple editable grid with a single store

  1. #1

    Multiple editable grid with a single store

    Hello,

    I have multiple grid with the same columns layout, the only different is that I have a column which is for filtering. Ex:

    COLUMNS
    Product Type
    Product Name
    Description
    Unit price

    Data returned from the server: we have virtual product and physical one, i want 2 grids in the same page which says: physical product and virtual product where user can input data into those 2 grids and then send the modified rows to serve for updating.

    instead of having 2 separated store loading data in 2 thread, i want to load data only in 1 thread and then do some filter magic in the client side for separate the data into 2 grids, and then reflect the data change in 1 master store only for sending back to the server for updating.

    Please show me how to do this.

    Thanks a lot in advance.
  2. #2
    Hello, @user2022!

    You can have two grids using the same store. When you apply a filter to one grid (a view filter), it creates a "virtual store" with the filtered data, so I believe you won't have a problem doing that.

    Please take a look at our Grid Panel examples, as there are many examples that may do just as you want.

    There's also this store binding example, a good starting point:
    - Data Binding - Basic - Chaining Stores

    Depending how you filter -- that is, if that's a store-level filter, you might require separate stores. In order to populate one with the other's data, you can just chain an event in the store, for when it gets data, then populate the second one via JavaScript, so no duplicate data download would be necessary at all. It would be something like:

    App.GridPanel2.getStore().loadData(App.GridPanel1.getStore().proxy.data);
    To duplicate the data from one grid to another. The way to get the raw source grid data may change depending how you populate it. In that case, the grid is populated using a StoreRead event (OnReadData=) like in this ArrayGrid example.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Link single store to multiple objects
    By edip in forum 4.x Help
    Replies: 2
    Last Post: May 01, 2017, 2:34 PM
  2. Replies: 2
    Last Post: Jan 25, 2016, 10:23 AM
  3. dynamic population of store not working for combo in editable grid
    By n_s_adhikari@rediffmail.com in forum 2.x Help
    Replies: 0
    Last Post: Aug 13, 2013, 4:58 PM
  4. Replies: 2
    Last Post: Sep 20, 2011, 4:25 AM
  5. Multiple vType on a Single Control
    By huzzy143 in forum 1.x Help
    Replies: 2
    Last Post: Sep 09, 2011, 3:39 PM

Posting Permissions