I use ExtJS 4.1.3 an Architect.
This is my JSON:
{"success":true,"message":"Ricerca eseguita con successo","data":[{"text":"1) PIA CASA","expanded":false,"leaf":false,"iconCls":"ICON_D","children":[{"text":"1) REP.TULIPANO","expanded":false,"leaf":false,"iconCls":"ICON_D","children":[{"text":"1) spese del personale","expanded":false,"leaf":false,"iconCls":"ICON_D","children":[{"text":"1) direzione generale","expanded":false,"leaf":true,"iconCls":"ICON_D","children":null,"cdaCode":"01-01-01-01","cda1":null,"cda2":null,"cda3":null,"cda4":1},{"text":"3) ragioneria","expanded":false,"leaf":true,"iconCls":"ICON_D","children":null,"cdaCode":"01-01-01-03","cda1":null,"cda2":null,"cda3":null,"cda4":3}]}
Code:
Ext.define('myModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'text'},
{name: 'expanded'},
{name: 'leaf'},
{name: 'iconCls'},
{name: 'children'},
{name: 'cdaCode'},
{name: 'cda1'},
{name: 'cda2'},
{name: 'cda3'},
{name: 'cda4'}
]
});
Ext.create('Ext.data.TreeStore', {
model: myModel,
proxy: {
type: 'ajax',
api: MyApi,
url: MyUrl,
reader: {
type: 'json',
idProperty: '',
messageProperty: 'message',
root: 'data'
}
}
});
When I load the store I see the tree, but when I click on the first item ("PIA CASA") I don't see its children but the tree is reloaded...
Immagine.png