extjs怎么加载xml 生成左边的树形菜单 求例子
2个回答
展开全部
研究一下 extjs的tree树形结果,已经封装的很简单了
Ext.require([
'Ext.tree.*',
'Ext.data.*'
]);
Ext.onReady(function() {
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'get-nodes.php',
extraParams: {
isXml: true
},
reader: {
type: 'xml',
root: 'nodes',
record: 'node'
}
},
sorters: [{
property: 'leaf',
direction: 'ASC'
},{
property: 'text',
direction: 'ASC'
}],
root: {
text: 'Ext JS',
id: 'src',
expanded: true
}
});
// create the Tree
var tree = Ext.create('Ext.tree.Panel', {
store: store,
hideHeaders: true,
rootVisible: true,
viewConfig: {
plugins: [{
ptype: 'treeviewdragdrop'
}]
},
height: 350,
width: 400,
title: 'Directory Listing',
renderTo: 'tree-example',
collapsible: true
});
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询