After comparing the documentation of the two classes, I am curious as to why one would use Ext.data.JsonStore as opposed to its superclass: Ext.data.Store. The documentation states the following about JsonStore:
Small helper class to make creating Ext.data.Stores from JSON data easier. A JsonStore will be automatically configured with a Ext.data.reader.Json.
The documentation then shows the typical configuration of a JsonStore as the following:
var store = new Ext.data.JsonStore({
// store configs
autoDestroy: true,
storeId: 'myStore',
proxy: {
type: 'ajax',
url: 'get-images.php',
reader: {
type: 'json',
root: 'images',
idProperty: 'name'
}
},
//alternatively, a Ext.data.Model name can be given (see Ext.data.Store for an example)
fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
});
The above code explicitly sets the reader type to 'json' - wouldn't the json type be implied in a JsonStore? This configuration doesnt seem any different to me than the way someone would configure a proxy to read a JSON file in an instance of Ext.data.Store.
Am I misunderstanding the use of Ext.data.JsonStore? If not, what is the benefit of using it over Ext.data.Store?
Thanks!
Ext.data.JsonStore
is just a store preconfigured with anExt.data.JsonReader
, so actually aExt.data.JsonStore
is just a convenience class to make it easier for the developer. Check this answer. – Sergey Novikov