Ext异步加载树(TREE) treeextjson
程序员文章站
2022-07-12 17:26:20
...
jsp页面:
var tree;
var ne;
var rightshowMenu;
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL="ext/resources/images/aero/s.gif";
var loader = new Ext.tree.TreeLoader({
url: "bookShop.do?parameter=treedata"
});
loader.on("beforeload", function(loader, node){
this.baseParams.id = (node.id);
});
var root = new Ext.tree.AsyncTreeNode({
id: "root",
text: "",
draggable: true //设置根节点是否可拖拽
});
tree = new Ext.tree.TreePanel({
renderTo: "tree-div",
useArrows: true,
autoScroll: true,
animate: true,
containerScroll: true,
rootVisible: false,
border: false,
root:root,
enableDD: true//允许拖拽
// listeners:{contextmenu:showMenu}
});
<%
for(int i=0;i<listrose.size();i++)
{
Rose rose=listrose.get(i);
%>
var croot=new Ext.tree.AsyncTreeNode({
id:"<%=rose.getId()%>",
text:"<%=rose.getName()%>",
allowDrag: false, // 在部门树里面,组织不支持拖拽
loader: loader
});
root.appendChild(croot);
<%
}
%>
tree.getRootNode().expand();
});
java:
public ActionForward treedata(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = request.getParameter("id");
log.info("展开节点根据 节点ID::" + id + ",获取子节点信息!");
List<Rose> list = roseBiz.resutlRosebyid(id);
JSONArray json = new JSONArray();
if (null != id && id.length() > 0) {
for (Rose rose : list) {
JSONObject temp = new JSONObject();
temp.put("id", rose.getId());
temp.put("text", rose.getName());
json.add(temp);
}
}else
{
log.info("节点下为空!");
}
log.info("展开节点,获取节点下面的信息:格式化返回::" + json.toString());
writerJSON(response, json.toString());
return null;
}
var tree;
var ne;
var rightshowMenu;
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL="ext/resources/images/aero/s.gif";
var loader = new Ext.tree.TreeLoader({
url: "bookShop.do?parameter=treedata"
});
loader.on("beforeload", function(loader, node){
this.baseParams.id = (node.id);
});
var root = new Ext.tree.AsyncTreeNode({
id: "root",
text: "",
draggable: true //设置根节点是否可拖拽
});
tree = new Ext.tree.TreePanel({
renderTo: "tree-div",
useArrows: true,
autoScroll: true,
animate: true,
containerScroll: true,
rootVisible: false,
border: false,
root:root,
enableDD: true//允许拖拽
// listeners:{contextmenu:showMenu}
});
<%
for(int i=0;i<listrose.size();i++)
{
Rose rose=listrose.get(i);
%>
var croot=new Ext.tree.AsyncTreeNode({
id:"<%=rose.getId()%>",
text:"<%=rose.getName()%>",
allowDrag: false, // 在部门树里面,组织不支持拖拽
loader: loader
});
root.appendChild(croot);
<%
}
%>
tree.getRootNode().expand();
});
java:
public ActionForward treedata(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = request.getParameter("id");
log.info("展开节点根据 节点ID::" + id + ",获取子节点信息!");
List<Rose> list = roseBiz.resutlRosebyid(id);
JSONArray json = new JSONArray();
if (null != id && id.length() > 0) {
for (Rose rose : list) {
JSONObject temp = new JSONObject();
temp.put("id", rose.getId());
temp.put("text", rose.getName());
json.add(temp);
}
}else
{
log.info("节点下为空!");
}
log.info("展开节点,获取节点下面的信息:格式化返回::" + json.toString());
writerJSON(response, json.toString());
return null;
}
推荐阅读
-
详解Jquery EasyUI tree 的异步加载(遍历指定文件夹,根据文件夹内的文件生成tree)
-
jquery使用EasyUI Tree异步加载JSON数据(生成树)
-
Ext.form.ComboBox,Extjs-树 Ext.tree.TreePanel
-
Ext Tree 加载超时 Timeout 问题的解决办法
-
Ext异步加载树(TREE) treeextjson
-
Ext异步加载树(TREE) treeextjson
-
Ext6 treePanel默认加载两级或多级本地树信息其他加载远程数据
-
Ext6 treePanel默认加载两级或多级本地树信息其他加载远程数据
-
vue ElementUI实现异步加载树
-
简单构造 Ext.tree 树例子