View Full Version : Grid Store snapshot

10 Jan 2011, 9:19 AM
I have noticed with Firebug that there is in Ext.data.store a property named snapshot which always holds the initial unfiltered records.
This was very helpful, because I wanted a similar attribute.
Is this a valid property in order to get the initial records? (This property does not hold the initial records after modify or deleting).

Any idea?

10 Jan 2011, 4:20 PM
You are just wanting the initial records? Or are you wanting to clear the filter?

To clear the filter to return all records the Store has:


If you are wanting the initial records, you can do it many way. I would prefer to extend Ext.data.Store. If it is a local Store, then you can do it in initComponent function and set your own parameter. If it is a remote Store, you will have to listen for the load event and set your own parameter then remove the load listener.

11 Jan 2011, 12:38 AM
It would be preferable if it were a property on store, like in Ext.form.Fields originalValue where it would hold the initial records.
I was wondering if it could be the snapshot property.

11 Jan 2011, 1:04 AM
1. A newly created record has a 'phantom' property set to true.
2. A modified record has a 'dirty' property set to true and a 'modified' property that holds the original field values (only of the fields that have changed).
3. A store has a 'modified' and a 'deleted' property that hold an array of modified and deleted records.

The original data used to load the store is also still available in the reader, so if you want to compare the current store with the original data, you could create a second store and load it with the original data from the reader.

11 Jan 2011, 3:53 AM
Thank you Condor,
I was thinking of a parallel store, too.
Moreover, do you know if the snapshot property of a store is a valid placeholder for unfiltered records?

11 Jan 2011, 4:21 AM
Yes, the snapshot holds all records (both filtered and unfiltered), but it doesn't hold a copy of the records, so you can't use it to check if any of the records are modified.

11 Jan 2011, 4:40 AM
OK Condor,
Thank you very much!