PDA

View Full Version : Spliting Store on load



radamanth
25 Aug 2010, 12:47 AM
Hi EveryOne.

I'm looking for a solution to split a Store in two after a load.

My point is to do 1 call instead of two to get all my data (2 grid in my case).

Has anyone ever did it ?

Regards.

schoonmoeder
25 Aug 2010, 1:20 AM
can't you add the store to bouth grids.
and then call load after you made the 2 grids.

just make sure the columns are richt for the 2 grids.
pseudocode


var baseStore = new Ext.store();
var grid1 = new Ext.grid({ store : baseStore, columns: [ a,b,c]});
var grid2 = new Ext.grid({ store : baseStore, columns: [ c,d,e]});
baseStore.load();

radamanth
25 Aug 2010, 1:28 AM
Thank you Schoomoeder.

That's an idea I could use. (having different columns for each data )

But in my case both data have the same column model.

schoonmoeder
25 Aug 2010, 1:32 AM
what's the difference between the 2 grids?
or should the one display data with id:1 and the other one with id:2

buz
25 Aug 2010, 1:46 AM
Create 2 jsonstores. Request the data with Ext.Ajax and load the data into the stores with store.loadData(json)

Or get the raw data from the first store.

radamanth
25 Aug 2010, 1:49 AM
Thanks !
I'm gonna try this.
I'll keep you posted

radamanth
25 Aug 2010, 2:01 AM
can't you add the store to bouth grids.
and then call load after you made the 2 grids.

just make sure the columns are richt for the 2 grids.
pseudocode


var baseStore = new Ext.store();
var grid1 = new Ext.grid({ store : baseStore, columns: [ a,b,c]});
var grid2 = new Ext.grid({ store : baseStore, columns: [ c,d,e]});
baseStore.load();




In my case I have grid like this :

var baseStore = new Ext.store();
var grid1 = new Ext.grid({ store : baseStore, columns: [ a,b,c]});
var grid2 = new Ext.grid({ store : baseStore, columns: [ a,b,c]});
baseStore.load();

I cant make difference on the store columns. I have one columns (type) wich permit me to sort them out.