PDA

View Full Version : How to use single store for multiple grids



elixir1
25 Nov 2013, 10:44 PM
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.

n_p_5555
26 Nov 2013, 3:07 AM
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

elixir1
26 Nov 2013, 4:29 AM
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.

n_p_5555
26 Nov 2013, 4:36 AM
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

elixir1
6 Dec 2013, 3:42 AM
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??