Results 1 to 5 of 5

Thread: How to use single store for multiple grids

  1. #1
    Sencha User
    Join Date
    Nov 2013
    Posts
    27
    Answers
    1

    Default How to use single store for multiple grids

    I have a single store(lets say 50 fields are there) and a panel containing 4 different grids. Each grid have some/few common fields. I have to load data into all the grids using this store only. Should I use only single store or multiple instances of the that store?
    Any thread/example will be very helpful.

  2. #2
    Sencha User
    Join Date
    Oct 2012
    Posts
    11

    Default Provide more detail about your requirement.

    Hi,

    Please provide more detail about your requirement of each grid.
    Because if you are using same store for multiple grids then remember one thing, Store will be used here like by reference. so if you will perform any kind of filter on store then it will affect your all grid.

    Thank You

  3. #3
    Sencha User
    Join Date
    Nov 2013
    Posts
    27
    Answers
    1

    Default

    Quote Originally Posted by n_p_5555 View Post
    Hi,

    Please provide more detail about your requirement of each grid.
    Because if you are using same store for multiple grids then remember one thing, Store will be used here like by reference. so if you will perform any kind of filter on store then it will affect your all grid.

    Thank You
    Lets assume I have these columns for 3 grids-
    grid 1 (f_name,m_name, l_name, address, phone)
    grid 2 ( f_name, father_name, mother_name)
    grid 3 (college_name, course, year)

    and I have a store containing all 10 different columns together. I am displaying these grids all together inside a panel at the same time. Some columns are common in these grids. Like f_name in grid1 & grid2.
    If I edit the f_name in grid1, then it should also update the grid2's f_name.

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    11

    Default

    Hi,

    Don't worry go ahead. When you will update detail for any record then your store will get updated and all grid will be reflected automatically.

    I think you just need to refresh all those grid once like.

    Ext.getCmp('Grid1').getView().refresh();
    Ext.getCmp('Grid2').getView().refresh();

    Thank You

  5. #5
    Sencha User
    Join Date
    Nov 2013
    Posts
    27
    Answers
    1

    Default

    Yup. That works. When I am updating any field, it gets updated in all the grids. I have another requirement.
    How to store these updated field data into database??

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •