I've found a lot of examples of how to load nested JSON stores when the children are a different model type, but I haven't found any that show you how to do the same thing if all of the children are of the same type. I have JSON data like this:
{
"ID": "id213",
"Name": "ItemName",
"ChildElements": [
{
"ID": "id321",
"Name": "ItemName2",
"ChildElements": [ //contains children ]
},
{
"ID": "id32154",
"Name": "ItemName3",
"ChildElements": [ //contains children ]
}
]
}
My model looks like this:
Ext.define('App.model.ElementsModel', {
extend: 'Ext.data.Model',
fields: [
{
name: 'Name'
}
],
hasMany: {
model: 'ElementsModel',
name: 'ChildElements'
},
proxy: {
type: 'ajax',
url: 'elements.json',
reader: {
type: 'json',
idProperty: 'ID'
}
}
});
and when I load the store, no child elements are being loaded. What am I doing wrong?