PDA

View Full Version : get simple store



mortezakhadem
4 Apr 2011, 4:58 AM
hi
i have a simple json data in javascript code
and i want get a simple jsonStore like this
store = new Ext.data.JsonStore({ data: curData});
but this line has error
when i set idProprety and fields that line correctly work
please help me
i don't want set idProperty and fields

Grolubao
4 Apr 2011, 5:28 AM
If you don't define fields how do you expect it to work?

httpdotcom
4 Apr 2011, 5:30 AM
JsonStore is an extension of Ext.data.Store, and has more requirements than Ext.data.SimpleStore.

Perhaps, if you are wanting your store to be a little more dynamic, you need to send meta data to the Reader object (see Automatic configuration using metaData @ http://dev.sencha.com/deploy/dev/docs/source/JsonReader.html#cls-Ext.data.JsonReader)

lukefowell89
4 Apr 2011, 8:11 AM
Basically you need to have an additional parameter on their which will act as the translator for the store. Defining each field that is contained in the json data

e.g.

field: [{name: 'test', dataIndex: 'test'}, {name: 'test2', dataIndex: 'test2'}],