PDA

View Full Version : copy data from one store to another



chrizmaster
2 Jan 2011, 4:10 AM
Hi,

I have a localstorage which holds data as a cache. Everytime I start my webapp, i ask the server if new data is available. if so, I set up a store with jsonProxy, collect the data and copy it from this store to the localstorage.

Is there any better method then iterating over the jsonstore data and copy it record by record into the localstorage? This is not the fastest operation on the iphone and I currently try to find a way which performs faster than this..

Chriz

mikeycgto
7 Apr 2011, 10:37 AM
Was wondering myself, doesnt seem to be anything built-in really for this. I have something like the following:



store2 = new Ext.data.Store();
store1.each(function(record){
store2.add(record.copy());
});

Jay Tanwar
21 Dec 2011, 10:03 AM
Dude mikeycgto (http://www.sencha.com/forum/member.php?241042-mikeycgto),
you saved my day.. :)

deepakpoda2000
26 Oct 2012, 8:47 AM
am not even able to iterate through the store

gives the below error
Uncaught TypeError: Cannot call method 'indexOf' of undefined



am using something like this
foodAllergiesGridStore.each(function(record){
//begg.add(record.copy());
console.log('asdf');
});

Yacine BRITAH
12 Nov 2013, 12:17 PM
Dońt use record.copy, just add the parameter in each loop