-
28 Jun 2011 9:52 AM #1
Recordtype undefined for JsonStore and ArrayStore
Recordtype undefined for JsonStore and ArrayStore
If I defined my store as a grouping store as follows:
The store.recordType works as expected. If I change the definition to either a JsonStore or ArrayStore, the store.recordType is undefined. The documentation for all 3 store are the same but underlaying behavior is not. Why? Is this a bug? What do I have to change to get recordType for JsonStore or ArrayStore?Code:paymentStore = Ext.extend(Ext.data.GroupingStore, { constructor: function(cfg) { cfg = cfg || {}; paymentStore.superclass.constructor.call(this, Ext.apply({ storeId: 'paymentStore', root: 'data', reader : new Ext.data.JsonReader( { fields: [ { name: 'paymentType', allowBlank: false, mapping: 'paymentType', type: 'int' }, { name: 'cash', allowBlank: false, mapping: 'cash', type: 'float' }, { name: 'check', allowBlank: false, mapping: 'check', type: 'float' } ] } ) }, cfg)); } }); new paymentStore();
-
24 May 2012 1:26 PM #2
Same in extjs4?
Same in extjs4?
I haved used designer to create my json store, but store.recordType is undefined for me too (store is okay).
-
4 Jun 2012 1:15 AM #3
jsonstore overwrites your reader
jsonstore overwrites your reader
Hi,
Please see the definition of JsonStore (same for ArrayStore):
Ext.data.JsonStore = Ext.extend(Ext.data.Store, {constructor: function(config){
Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.JsonReader(config)
}));
}});
It overwrites your reader if you extend JsonStore/ArrayStore and passes config directly into the reader. But in your example, you're trying to pass your fields into your reader and they are gone. And the result is a reader without any fields definition. So it does not create any recordType.
If you remove the reader, and put fields into the config, it would probably work. See below:
Code:paymentStore = Ext.extend(Ext.data.JsonStore, { constructor: function(cfg) { cfg = cfg || {}; paymentStore.superclass.constructor.call(this, Ext.apply({ storeId: 'paymentStore', root: 'data',fields: [{ name: 'paymentType', allowBlank: false, mapping: 'paymentType', type: 'int' }, { name: 'cash', allowBlank: false, mapping: 'cash', type: 'float' }, { name: 'check', allowBlank: false, mapping: 'check', type: 'float' } ]}, cfg)); } }); new paymentStore();sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote