87,904
社区成员
发帖
与我相关
我的任务
分享
Ext.define('SMS.view.Menu',{
extend: 'Ext.tree.Panel',
alias: 'widget.smsmenu',
requires:['SMS.store.Menus'],
initComponent : function(){
var tree = this;
Ext.apply(this,{
id: 'menu-panel',
iconCls:'icon-menu',
margins : '0 0 -1 1',
region:'north',
border : false,
enableDD : false,
split: true,
width : 212,
height:360,
minSize : 130,
maxSize : 300,
rootVisible: false,
containerScroll : true,
//collapsible : true,
autoScroll: false,
store:Ext.create('SMS.store.Menus'),
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '展开',
iconCls: 'expand',
handler: function(){
tree.expandAll();
}
}, {
text: '折叠',
iconCls: 'collapse',
handler: function(){
tree.collapseAll();
}
}]
}]
});
this.callParent(arguments);
}
})
Ext.define('SMS.store.Menus',{
extend: 'Ext.data.TreeStore',
proxy: {
type: 'ajax',
url: 'users.json'
},
root: {
expanded: true,
}
})
TimesLeader.resMgr = Ext.create('Ext.tree.Panel', {
title: '',
frame:true,
useArrows: true,
root:treeData,//treeData是向后台请求得到的json格式数据
}
[
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
checked: null
children: Array[2]
code: null
guid: "00000000-0000-0000-0000-000000000000"
icon: null
id: "root"
leaf: false
parent_id: null
text: "root"