I am using ExjJs 4.2 .I have two grids displaying different data. In one javascript file i have to include both the grids. I am loading the store for the first grid like
var store = Ext.create('Ext.data.Store', {
model: 'Writer.Person',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'findPatientRecordAction',
reader: {
type: 'json',
successProperty: 'success',
root: 'data',
messageProperty: 'message'
},
writer: {
type: 'json',
encode: true,
root: 'data'
},
fields: ['id','notes', 'startDate', 'endDate'],
},
});
The JSON object store looks like this :
"data":[{"id":35,"notes":"hiii","startDate":"2013-04-30","endDate":"2013-05-02"}]} , "details":[{"id":14,"document":"docpath12345","date":"2013-04-28"}]
Actually the first grid will display only the 'data' part of JSON and the second grid will display the 'details' part of JSON. So ideally i should not load the store object again for the second grid(what i am doing now).I want to declare one more store type variable and reuse value of 'store' (the 'documents' part of store) to become the store for second grid as
I am loading the second store as of now like this
var store2 = Ext.create('Ext.data.Store', {
model: 'Writer.Document',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'findPatientRecordAction',
reader: {
type: 'json',
successProperty: 'success',
root: 'details',
messageProperty: 'message'
},
writer: {
type: 'json',
encode: true,
root: 'details'
},
fields: ['id','document', 'date'],
},
});`.
In both the cases i am calling the same action and getting the same JSON.
Can anyone help me out here that how can I declare another store object and get the value from the existing 'store' so that i should not have to load the same data for 2 times.
Regards : Dev