View Full Version : Ext.data.Store reader format

28 Jun 2010, 7:39 AM
Hello, I'm trying to understand how to properly format the JSONReader for my Ext.data.Store object.
I cannot figure out how to format or prototype the Store record. No matter what I do, the Firebug debugger always shows an error "Record.prototype is undefined".

Any help would be greatly appreciated. See my sample code below:

this.store = new Ext.data.Store({
// USE proxy to modify request properties
proxy: new Ext.data.HttpProxy({
headers: {'Authorization':Ext.util.Cookies.get('auth'),
method : 'GET'

Returns this JSON data structure. I'm interested in the data-array content.

reader: new Ext.data.JsonReader({
root: 'test-data',
totalProperty: 'totalcount',
id: 'data-array'
{name:'mytestdata', mapping: 'test-data'},
{name:'data', mapping: 'mytestdata.data-array'},
{name: 'code', mapping: 'data.code'},
{name: 'description', mapping: 'data.description'}


28 Jun 2010, 8:59 AM
For a start, use a JsonStore (http://www.sencha.com/deploy/dev/docs/?class=Ext.data.JsonStore). Take a look at the \examples\grid-filtering\grid-filtering-local.js (and grid-filter.json) files for an example of what to do.

Remove the "test-data" property name and try this:


// ...

this.store = new Ext.data.JsonStore({
// ... Additional config options as needed.
root: 'data-array',
idProperty: 'code',
totalProperty: 'totalcount',
fields:[ { name: 'code' }, { name: 'description' } ]

P.S. Always use CODE tags when posting.

28 Jun 2010, 10:18 AM
Thanks Fay

I was trying not to change the server side code as it's used by another application... it looks like that is my only hope. I understand how to make the basic JSON format work, it's just the nested format that I currently have is no good for ExtJS. I'll change the server to make it work.