I'm trying to load a single json object using sencha touch. When I work with arrays, all is well, but I havn't find a way of loading a single object into an Ext.data.Store
here is a sample of what I'm trying to load:
{"person":{"name":"John","surname":"Fox"}}
and it's not working. after looking at this entry,
I tried to load the following and it worked:
[{"person":{"name":"John","surname":"Fox"}}]
My questions is: is there a way of loading it w/o the [ ]? I had to modify my server side code in order to do this and it feels to me like a code smell... I want to be able to load a single json object w/o putting it into a list.
here is my Sencha Touch proxy code:
Ext.regModel("Person", {
fields: ['name','surname']
});
var store = new Ext.data.Store({
model : "Person",
autoLoad : true,
proxy: {
type: 'ajax',
url : 'my json url...',
reader: {
type: 'json',
record: 'person'
}
}
});
BTW - my server side code is in Ruby on Rails.