These are actually two different things. A Ext.data.JsonReader reads the given JSON object and returns data records ( Ext.data.Record ), which are then stored by the corresponding data store.
Ext.data.Store is the base class for all Ext storages and uses auxiliary objects for data extraction ( Ext.data.DataProxy ) for writing data ( Ext.data.DataWriter ) and for reading data ( Ext.data.DataReader ). These base classes have different tastes, such as:
All this creates up to a very extensible component that allows the developer to fine-tune what he needs to configure. To simplify the work of developers (especially new ones), Ext comes with some pre-configured data warehouses:
So in fact Ext.data.JsonStore is just a convenience class to make it easier for the developer.
The following two fragments will create the same (or comparable) stores:
var store = new Ext.data.JsonStore({ url: 'get-images.php', root: 'images', idProperty: 'name', fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}] }); // or var store = new Ext.data.Store({ url: 'get-images.php', reader: new Ext.data.JsonReader({ root: 'images', idProperty: 'name', fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}] }); });
source share