View Full Version : Do I need to copy json store

31 Mar 2011, 8:12 AM
I have a JsonStore and I pull the data to fill the store from my server.

I use this store for a few different combo boxes and also in a ListView.

I am allowing users to filter the list view but when I filter the view I am actually filtering the store for that view.

Problem is that this affects my other combo boxes.

Since I don't really want to request the data from the server multiple times I think the only way to do this is have multiple copies of this store.

Is that true, or is there a better way to do this?

If I need to make copies is the best way to do this listen to the 'load' event on the store and then create another store?

I read in the forms that you might be able to do the following, but I had no luck.

For remote/JSON stores this has been tested to work well without any dependencies:

PHP Code:
// the "store" variable is an instance containing the source store
var newStore = new Ext.data.Store( {
proxy : store.proxy,
reader : store.reader,
sortInfo : store.sortInfo


31 Mar 2011, 10:41 AM
You could retrieve the data as a block of JSON, early on when your app is first loaded. The data could then be fed directly to several different stores, via the 'data' attribute on each Store's config. This way you only make one server-side call for data.

The only other worry you'll have is the data going stale and when/how to refresh it.