PDA

View Full Version : JsonStore/SimpleStore code cleanup



Condor
17 Nov 2008, 12:52 AM
I propose to change the JsonStore and SimpleStore constructors to:

Ext.data.JsonStore = function(config){
Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.JsonReader(config)
}));
};
Ext.data.SimpleStore = function(config){
Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.ArrayReader(config)
}));
};
1. JsonStore doesn't need to create a HttpProxy for the url (Store already does this).
2. JsonReader and ArrayReader don't need the recordType parameter if the meta parameter already contains the fields config option.
3. SimpleStore shouldn't create a record class from the fields (DataReader already does this and it excludes the possibility to pass in your own record class).

jack.slocum
17 Nov 2008, 12:11 PM
Thanks for the ideas. We made a similar change for 3.0 but it hasn't hit SVN yet.