我定义了一个treepanel
扩展extend: 'Ext.tree.Panel'
,它具有类似的 initComponent 功能
Ext.define('Example', {
extend: 'Ext.tree.Panel',
title: 'Example',
useArrows:false,
rootVisible: false,
border: false,
initComponent: function () {
var store = Ext.create('Ext.data.TreeStore', {
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'}
],
autoLoad : false, // not working
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'results'
}
}
});
this.store = store;
this.callParent(arguments);
}
});
我尝试设置autoLoad: false
,但是当我创建我的时总是加载treepanel
当我尝试配置下面的代码来存储然后autoLoad: false
工作但我的treepanel
加载后是空白的
root: {
text: 'Ext JS',
id: 'src',
expanded: false // this
}
root
如果不使用类似的配置,我的 json 很好并且可以工作
({ "results": [
{
id : '1' ,
text : '1',
expanded: true,
results :[{
id : '2' ,
text : '2',
leaf:true
}]
},{
id : '3' ,
text : '3',
leaf:true
}]
})
怎么解决谢谢。