1.extjs中调用tree实现树列表功能
goodsTree.on('click', function(node){
treeClicNode.id = node.id;
treeClicNode.text= node.text;
treeClicNode.depth = node.getDepth();
var id = node.id.split(":")[1];
if(node.getDepth()>=2){
Ext.Ajax.request({
url : '${loadName}',
params:{
"systemIdToTable.treeId":id
},
success : function(response) {
var resText = Ext.util.JSON.decode(response.responseText);
if (resText.result) {
commForm.getForm().reset();// 重置公共模块中所有选项
Ext.getCmp('content-panel').layout.setActiveItem(resText.data.tableName);
Ext.get(resText.data.tableName).slideIn("r");
} else {
Ext.Msg.alert("提示", "操作失败!");
}
},
failure : function(response) {
Ext.Msg.alert("提示",
"<font color='red'>服务器连接失败,请联系管理员!</font>");
}
});
}
});
Ext.onReady(function(){
var border = new Ext.Viewport({
layout:'border',
renderTo:Ext.getBody(),
items:[{
region:'center',
split:true,
border:true,
layout:'border',
items:[goodsTree]
}]
});
});
2.tree实现的js代码goodsTree.js
var goodsTree = new Ext.tree.TreePanel({
id : "deptTree",
autoScroll : true,
title : "<div class=\"icon_folder\">物品列表</div>",
region : "west",
root : new Ext.tree.AsyncTreeNode({
id : "conGoods:1",
text : "物品列表"
}),
margins : '0 0 0 0',
layout : 'fit',
split : true,
width : 200,
minSize : 100,
maxSize : 350,
useArrows : true,
collapsible : true,// 可折叠
rootVisible : true,
bodyStyle : "background:#C5D3E7 ;"
});
var selectNode = {};
var dataUrll;
goodsTree.on("beforeload", function(node) {
goodsTree.loader.dataUrl = "/KingeeAST/ast/tree/goodsTreeLoder.action?key="
+ node.id;
});
3.调用goodsTreeLoder后返回的ftl文件goodsTree.ftl
[
<#list model.childConsumables as f>
{"id":"conGoods:${f.id!""}","text":"${f.name!""}","leaf":<#if f.childConsumables?size gt 0>false<#else>true</#if>,"check":false
}<#if f_has_next>,</#if>
</#list>
]
4.配置struts映射文件struts-tree.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="kingee-ast-tree" extends="kingee_ast_default" namespace="/ast/tree">
<action name="goodsTreeLoder" class="businessTreeAction">
<result name="conGoods" type ="freemarker">/common/tree/goodsTree/goodsTree.ftl</result>
</action>
</package>
</struts>
5.配置spring映射文件applicationContext-tree-action.xml
<!-- 系统树 Action -->
<bean id="businessTreeAction" class="com.kingee.ast.tree.action.BusinessTreeAction" scope="prototype">
<property name="hibernateTemplate" ref="astHibernateTemplate"></property>
<property name="classDefine">
<map>
<entry key="conGoods" value="com.kingee.ast.system.pojo.SystemConsumables"></entry>
</map>
</property>
</bean>
6.树的具体实现action代码BussinessTreeAction.java
public class BusinessTreeAction extends ActionSupport{
private HibernateTemplate hibernateTemplate;
private Map<String, String> classDefine;
private String key;
private Object model;
@Override
public String execute() throws Exception {
if(null==key || "".equals(key)){
return SUCCESS;
}
String[] keys=key.split(":");
if(keys.length>1){
String type=keys[0];
String id=keys[1];
if("1".equals(id)){
try {
Class clzz=Class.forName(classDefine.get(type));
model=hibernateTemplate.get(clzz, "1");
} catch (Exception e) {
e.printStackTrace();
}
}else{
model=hibernateTemplate.get(classDefine.get(type), id);
}
return type;
}else{
return SUCCESS;
}
}
}
7.写出树中要展示的列表的实体类SysConsumables.java
public class SystemConsumables extends MunalBean{
private String name;
private String pid;
private String id;
private SystemConsumables parentConsumables;
private Set<SystemConsumables> childConsumables;
}//getter和setter省略了
8.写出实体类hibernate的配置文件,自对自的映射systemConsumables.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.kingee.ast.system.pojo">
<class
name="SystemConsumables"
table="ast_sys_consumables"
dynamic-update="true"
>
<meta attribute="sync-DAO">true</meta>
<id
name="Id"
type="string"
column="id"
>
<generator class="uuid.hex"/>
</id>
<property
name="name"
column="name"
type="string"
length="100"
/>
<property
name="deleted"
column="deleted"
type="boolean"
/>
<many-to-one name="parentConsumables" class="com.kingee.ast.system.pojo.SystemConsumables" column="pid">
</many-to-one>
<set name="childConsumables" lazy="true" inverse="true" order-by=" id desc ">
<key column="pid"></key>
<one-to-many class="com.kingee.ast.system.pojo.SystemConsumables"/>
</set>
</class>
</hibernate-mapping>
分享到:
相关推荐
【描述】提到的"一个相当不错的ext源码",意味着这个压缩包包含了一套完整的EXTJS代码示例,开发者可以直接下载并导入到自己的项目中。通过"用hibernate的实体类映射文件生成数据库",我们可以理解这个示例可能依赖...
这个名为“ssh+ext+json+dwr技术实现的动态树”的项目结合了这些技术,为我们提供了一个生动的示例,展示了如何在实际项目中有效地整合它们。 SSH(Spring、Struts、Hibernate)是Java Web开发的三大框架,它们各自...
描述中提到的“ext tree 与ssh2的结合,主要演示ext在ssh2中的使用”为我们提供了关键信息:这是一个关于如何在SSH2框架中集成EXT库,特别是其树形视图(Tree)功能的示例。 首先,我们需要了解SSH2(Struts、...
在本文中,SSH框架被用于构建一个后台系统,用于支持前端ExtJS应用的动态树搜索功能。 ExtJS是一个流行的JavaScript库,用于创建富客户端Web应用程序,特别是用于构建数据驱动的用户界面。在描述的场景中,ExtJS被...
综上,EXT 图书管理系统通过集成SSH和MYSQL数据库,实现了高效、稳定且用户友好的图书管理解决方案,适用于图书馆、书店或其他需要图书管理的机构。开发过程中,开发者需熟练掌握EXT JS的组件使用、SSH框架的协同...
可以把grid直接拖到tree,不同于其他的例子,拖动grid后会在tree中加一个叶子节点,大家试下就会明白。 自己练习用的哦,做的不好不要骂我,哪里不好希望大家包涵。 本人qq :784027965 大家学习happy哈^_^
在IT行业中,SSH和Ext是两个非常重要的框架,它们在Web开发中有着广泛的应用。SSH通常指的是Spring、Struts和Hibernate这三个开源框架的组合,而Ext则是一个基于JavaScript的前端框架,用于构建富互联网应用程序...
4. **结果收集与分析**:SSH Sampler会返回命令执行的结果,包括标准输出和错误输出,这些可以在JMeter的监听器中查看,如"View Results Tree"。你可以根据返回结果分析远程服务器的性能状态。 5. **性能测试**:...
分多了点O(∩_∩)O哈哈~ ! 使用说明:压缩的eclipse项目文件,请改后缀然后解压import进myeclipse,请更改对应的数据库配置beans.xml,hibernate自动创建数据库的配置做相应修改,部署运行VIP/tree/tree.html就可以了
matlab中求及格率代码SSH Windows 这是Windows版本 如何建造 克隆存储库并构建caffe-ssh git clone --recursive https://github.com/imistyrain/SSH-Windows.git cd SSH-Windows git clone ...
对于动态加载树,使用Ext.tree.TreeStore和Ext.tree.TreePanel,配置树的异步加载,通过Ajax请求获取子节点数据。 - **更新**:当用户修改数据后,ExtJS可以通过AJAX将变化发送到服务器。Struts2接收请求,更新相应...
struts+hibernate+spring+ext,界面很友好,树...(struts+ hibernate+ spring+ ext, the interface is very friendly, tree control menu can be run directly into Myeclipse, it is worth the value of collections)
卷 (USB)Project 的文件夹 PATH 列表 卷序列号码为 0006EE44 CCBE:F425 I:. │ .project │ pom.xml │ pom.xml~ │ text.txt │ ├─.settings │ org.maven.ide.eclipse.prefs ...│ │ org.eclipse.wst.common....
1. 获取源代码:首先,你需要从Linux内核官方仓库(如git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git)获取最新的稳定内核源代码。 2. 配置内核:运行`make ARCH=arm CROSS_COMPILE=arm-...
将`BOOT.bin`、`devicetree.dtb`、`uImage`和解压后的`uramdisk.image.gz`(或者更常见的,一个包含EXT4文件系统的映像文件)复制到相应的分区后,就可以将SD卡插入ZedBoard并启动系统。 在Linux运行后,你可以通过...
- **文件系统**:组织和管理存储设备上的文件,支持多种格式如ext3、ext4等。 - **应用程序**:包括X-Window图形界面、OpenOffice办公套件等。 ##### Linux版本 - **发行版**:由不同组织或个人编译打包而成的...
2. **Windows连接SSH问题**:首次连接时可能出现主机标识更改的情况,解决方法是在本地电脑命令行中输入`ssh-keygen -R 服务器ip`或删除`~/.ssh/known_hosts`文件。 3. **编译net-snmp问题**:若编译过程中未生成...
find /home/user1 -name \*.bin 在目录 '/ home/user1' 中搜索带有'.bin' 结尾的文件 find /usr/bin -type f -atime +100 搜索在过去100天内未被使用过的执行文件 find /usr/bin -type f -mtime -10 搜索在10天内...
在Linux中,命令行界面是其主要的交互方式,通过各种命令可以实现对系统的各种操作。以下是对标题和描述中提及的Linux命令的详细说明: **文件操作**: 1. `cat`:用于查看文件内容,也可用于合并多个文件。 2. `...
磁盘操作命令包括 `cd` 和 `pwd` 用于切换和查看当前工作目录,`df` 显示磁盘使用情况,`du` 显示文件和目录的大小,`e2fsck` 用来检查 ext2 或 ext3 文件系统的完整性,`fdisk` 用于硬盘分区,`fsck` 检查并修复...