
1,你引入ext包的路径,最好别写绝对路径,不知道你用什么写的,我用的是jsp,引入时
src="<%=request.getContextPath()%>/extjs/adapter/ext/ext-base.js">
这样写比较稳妥
2,是你a.txt文件的位置问题,如果不写绝对路径,尽量保证和你的页面文件在同一个文件夹里
3,你的json串是有问题的,虽然树可以出来,但是你的“not leaf”文件夹会无限的打开,因为在ext里,如果不是子节点,他一定要有子节点,否则会出现单击文件夹会无限打开的情况。
我也是Ext新手,大家多多帮助,呵呵
你只有返回的json数据格式对就可以了,下面有个例子自己看看吧var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
})
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody()
})
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)