Extjs加载本地的一个json文件

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-1 10:35   42   0


<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,
width: 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 错误 这个可能与版本的问题

转载于:https://www.cnblogs.com/wuhanly/p/4133222.html

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP