<head>
<title></title>
<link href="../Styles/Extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="../Styles/Extjs/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="../Styles/Extjs/extjs/ext-all-debug.js" type="text/javascript"></script>
<script type="text/javascript">
var tree = new Ext.tree.TreePanel({
animate: true,
renderTo: Ext.getBody(),
rootVisible: true,
autoScroll: true,
autoHeight: true,
lines: true,
300,
loader: new Ext.tree.TreeLoader({
preloadChildren: true,
clearOnLoad: false,
dataUrl: 'data.json'
}),
root: new Ext.tree.AsyncTreeNode({
text: 'Extjs',
id: 'root',
expanded: false
}),
collapseFirst: false
});
</script>
</head>
<body>
</body>
</html>
在json文件中添加自己的想要加载的树节点 类似:[
{'text':'not leaf',children:[{'text':'is leaf',leaf:true}]},
{'text':'is leaf',leaf:true}
]
有时候加载的时候 提示http 405 错误 这个可能与版本的问题