PDA

View Full Version : Issue with Inheritance using Ext.data.Store



jeetmarwah
20 Jan 2012, 12:19 PM
I am trying to apply inheritance to my store. I have multiple tabs and I have created a common store for all the tabs but I need separate instances/copies of it to have the state saved for those tabs.

The sequence of events are as follows:
- application loads,
- data is shown on tab 1
- click on tab 2
- do some actions on it to load some more data on tab2, say that its on page 2 and param 'start' is set to 20
- come back to tab 1
- the params that its takes is of tab 2. The param 'start' for this tab 1 should be '0' but it is '20' which is set on tab 2.

Not sure why this is happening. Please let me know if you have any ideas

Here is the code.



var __postPageSize__ = 20;


Ext.define('RS.store.common.SocialStore', {
extend: 'Ext.data.Store',
requires: 'RS.model.Post',
model: 'RS.model.Post',
//storeId: 'homepostsstoreid',
pageSize : __postPageSize__,
remoteSort: true,
buffered: true,
proxy: {
type: 'ajax',
//url: 'data/postData.json',
url : '/resolve/service/getPost',
extraParams: {
displayName: 'Blog',
sysid: '__sysid__',
comptype: 'Blog',
gridItemClick: false,
infiniteScroll: false,
start: 0,
limit: __postPageSize__
//,total: 50000
},
reader: {
type: 'json',
totalProperty: 'totalCount',
root: 'results'
},
// sends single sort as multi parameter
simpleSortMode: true
}

});





Ext.define('RS.store.HomePostsStore', {
requires: 'RS.store.common.SocialStore',
extend: 'RS.store.common.SocialStore',
storeId: 'homepostsstoreid'
});







Ext.define('RS.store.AdvancePostStore', {
requires: 'RS.store.common.SocialStore',
extend: 'RS.store.common.SocialStore',
storeId: 'advancepostsstoreid'
});

jeetmarwah
24 Jan 2012, 12:05 PM
Is there any way to use inheritance for Store? Please advise.

Thanks,
Jeet