PDA

View Full Version : How do I retrieve JSON for use in a store when I don't know the field names?



mitts2010
27 Feb 2014, 4:30 PM
My JSON is return in this format:


{"svsadfsa":{"name":"Noah Mckinney","email":"eget@etnuncQuisque.edu"},"asdfasdf":{"name":"Patrick Haney","email":"tristique.pellentesque@pretiumaliquet.com"}}

Where the field names are the object's ID, I don't know what they will be or how many there are.

scottmartin
27 Feb 2014, 5:39 PM
Any chance of a root above the unknown field names?

You might have to override Reader :: getResponseData to gather the incoming data and part it yourself

dawesi
27 Feb 2014, 9:28 PM
you can also use the column index for this in your model instead of a name.

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Model-cfg-fields

(http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Model-cfg-fields)http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Field-cfg-mapping


field definition:
{ name : 'custom', mapping : 0 }