I am in trouble with the ExtJS 4.0.7 TreePanel. I would like to load the complete tree from on JSON request. The request returns the following:
{
"data": {
"children": [
{
"text": "OS",
"leaf": false,
"children": [
{
"text": "Hostname",
"leaf": false,
"children": [
{
"text": "hostname.int.com",
"leaf": true,
"children": []
}
]
}
]
}
]
}
}
With it doesn't work with the following store configuration (or any other i've tried)
Ext.define('My.store.SysInfo', {
extend: 'Ext.data.TreeStore',
model: 'My.model.SysInfo',
proxy : {
type : 'ajax',
url : '/sysinfo/getSysInfo.php',
reader : {
root : 'data'
}
}
});
The Model has the following code:
Ext.define('My.model.SysInfo', {
extend: 'Ext.data.Model',
fields: ['text']
});
When adding a treepanel with this configuration, it doesn't work:
{
xtype: 'treepanel',
name : 'sysinfo',
height: '100%',
store: 'My.store.SysInfo',
lines: true,
autoScroll : true,
expanded : true,
rootVisible: false,
folderSort: true,
multiSelect: false,
useArrows: true,
}
By opening a node, ExtJS always loads the whole tree from it's root node into the subnode by requesting it via ajax, instead of showing the preloaded data. How can i achieve, that it loads the "Hostname" node by opening "OS"?