<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'ext1.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/ext-all.css">
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var root = new Ext.tree.TreeNode({
id:"root",
text:"树的根"
});
root.appendChild(new Ext.tree.TreeNode({
id:"c1",
text:"子节点"
}));
var tree = new Ext.tree.TreePanel({
renderTo:"hello",
root:root,
width:100
});
});
</script>
</head>
<body>
<div id="hello"></div>
</body>
</html>
8 个解决方案
#1
自己先顶一下吧
#2
<link rel="stylesheet" type="text/css" href="extjs/ext-4.0.0-gpl/ext-4.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/ext-4.0.0-gpl/ext-4.0.0/bootstrap.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
text:"",
user:"",
status:"",
children: [
{ text:"detention", leaf: true },
{ text:"homework", expanded: true,
children: [
{ text:"aaa"},
{ text:"bbb"}
]
},
{ text: "buy lottery tickets", leaf:true }
]
}
});
var tree=Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
store: store,
height: '100%',
rootVisible: false,
listeners : {
'itemclick' : function(view,re){
alert(re.data.id);
}
}
});
#3
顶一下,我也遇到了同样的问题
#4
问题解决没有啊,我也遇到这个问题了,关键还是我在自己电脑上是好的,换到公司电脑上就出这个错了
#5
直接给JSON就好了别NEW来NEW去的
#6
Ext什么版本的?
#7
原来还没结的!我的问题是项目中没有把ext所需要的js导进去,后面我把下载的ext文件全导进去,ok了!
#8
你看下是不是js文件路径不对
#1
自己先顶一下吧
#2
<link rel="stylesheet" type="text/css" href="extjs/ext-4.0.0-gpl/ext-4.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/ext-4.0.0-gpl/ext-4.0.0/bootstrap.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
text:"",
user:"",
status:"",
children: [
{ text:"detention", leaf: true },
{ text:"homework", expanded: true,
children: [
{ text:"aaa"},
{ text:"bbb"}
]
},
{ text: "buy lottery tickets", leaf:true }
]
}
});
var tree=Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
store: store,
height: '100%',
rootVisible: false,
listeners : {
'itemclick' : function(view,re){
alert(re.data.id);
}
}
});
#3
顶一下,我也遇到了同样的问题
#4
问题解决没有啊,我也遇到这个问题了,关键还是我在自己电脑上是好的,换到公司电脑上就出这个错了
#5
直接给JSON就好了别NEW来NEW去的
#6
Ext什么版本的?
#7
原来还没结的!我的问题是项目中没有把ext所需要的js导进去,后面我把下载的ext文件全导进去,ok了!
#8
你看下是不是js文件路径不对