Hello,
i want to load a complete Tree with ajax at once. My get-tree.php returns following json:
Code:
{"root":{"expanded":true,"children":[{"text":"Suche","leaf":true},{"text":"Projekt","expanded":true,"children":[{"text":"Planung","leaf":true},{"text":"Pruefung","leaf":true}]},{"text":"Abmelden","leaf":true}]}}
My app.js looks like:
Code:
Ext.onReady(function() {
/*var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "Suche", leaf: true },
{ text: "Projekt", expanded: true, children: [
{ text: "Planung", leaf: true },
{ text: "Pruefung", leaf: true}
] },
{ text: "Abmelden", leaf: true }
]
}
});*/
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url : 'get-tree.php',
reader: {
type: 'json',
root: 'children'
}
}
});
Ext.create('Ext.Viewport', {
renderTo: Ext.getBody(),
border: false,
layout: {
type: 'border',
padding: 5
},
items: [{
xtype:'treepanel',
region:'west',
title:'Navigation',
width: 200,
height: 150,
store: store,
rootVisible: false,
margins: '5 0 0 0',
cmargins: '5 5 0 0',
collapsible: true,
width: 175
},{
region:'center',
margins: '5 0 0 0',
xtype: 'panel',
title: 'main',
id: 'main',
html: 'Willkommen'
}]
});
})
The local static store works but the ajax store does not. What is wrong with it?
Thanks for the help.