我将我的树店定义为:
Ext.define('Portal.store.GroupsTreeStore', {
extend: 'Ext.data.TreeStore',
model: 'Portal.model.GroupTreeModel',
autoLoad: false,
proxy: {
method: 'get',
type: 'ajax',
url: 'groups/get',
reader: {
type: 'json',
successProperty: 'success',
messageProperty: 'message',
root: 'data'
}
},
// Prevent auto loading
root: {
expanded: true,
text: "",
"data": []
}
});
我的模特:
Ext.define('Portal.model.GroupTreeModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'type', type: 'string'}
]
});
我收到的JSON数据如下:
{
"success": true,
"message": "ok",
"data": [{
"name": "group1",
"type": "group",
"expanded": true,
"children": [{
"name": "admin_2503",
"type": "people",
"leaf": true
},
{
"name": "u1",
"type": "people",
"leaf": true
},
{
"name": "u2",
"type": "people",
"leaf": true
}]
},
{
"name": "group2",
"type": "group",
"expanded": false,
"leaf": false,
"children": [{
"name": "u5",
"type": "people",
"leaf": true
}]
}]
}
我想一次加载我的所有树存储数据并在本地工作后(例如搜索,过滤等),但是使用此存储配置,所有节点都显示未扩展,并且在展开操作上执行查询以提供{{1使用节点ID,接收相同的JSON并添加url: groups\get
和group1
作为节点子节点。我应该如何为此目的配置我的商店?
更新视图定义:
group2
});