F9 开发之左树右表中的左树
1 首先在前端应用树树控件
<div class="fui-left">
<div role="head" title="地区选择"></div>
<div role="body">
<div id="key" class="mini-textbox hidden" style="width: 150px;" onenter="onKeyEnter" />
<div class="mini-button hidden" style="width: 50px;" onclick="search()">查询</div>
<div id="tree1" class="mini-tree" showFolderCheckBox="true" action="treeModel" canCheckParent="true"></div>
</div>
</div>
2 在后台要有一个变量与之对应
private TreeModel treeModel = null;
3 这个变量的get方法来获得数据
public TreeModel getTreeModel() {
if (treeModel == null) {
treeModel = new TreeModel()
{
private static final long serialVersionUID = 1L;
@Override
public List<TreeNode> fetch(TreeNode pNode) {
List<Record> tmplist;
String guid = "";
if (pNode != null)
guid = pNode.getId();
// 根节点
if (StringUtil.isBlank(guid)) {
tmplist = service.findList(
"select CityName,CityCode from HuiYuan_City where right(CityCode,4)='0000' order by CityCode ",
Record.class);
}
else {
guid = Functions.TrimEnd(guid, "0");
String sql = "";
if (guid.length() == 2) {
sql = "select CityName,CityCode from HuiYuan_City where citycode like '" + guid
+ "%' and right(CityCode,2)='00' and right(CityCode,4)<>'0000' order by CityCode";
}
else if (guid.length() == 4) {
sql = "select CityName,CityCode from HuiYuan_City where citycode like '" + guid
+ "%' and right(CityCode,2)<>'00' order by CityCode";
}
tmplist = service.findList(sql, Record.class);
}
List<TreeNode> treeNodes = new ArrayList<TreeNode>();
//修改在省级子节点中出现"所有地区"节点的问题 by dingbq 2016-8-29
if(StringUtil.isBlank(guid)){
TreeNode node1 = new TreeNode();
node1.setId("999");
node1.setText("所有地区");
node1.setLeaf(false);
node1.setExpanded(true);
treeNodes.add(node1);
}
for (Record record : tmplist) {
TreeNode node = new TreeNode();
node.setId(record.getStr("CityCode"));
node.setText(record.getStr("CityName"));
String code = node.getId();
if(StringUtil.isBlank(guid)){
node.setPid("999");
}
if (code.endsWith("00"))
node.setLeaf(false);
else
node.setLeaf(true);
treeNodes.add(node);
}
return treeNodes;
}
};
}
return treeModel;
}
F9 开发之左树右表中的左树的更多相关文章
- eas左树右表基础资料界面引用为左树右表F7的简单方法
age: /** * 加载配件F7(左树右表) * @param F7Filed 要加载的F7控件 * @param ctx 界面上下文 * @单据 ...
- java小工具,使用Swing展示左树右表结构
代码直接上: 入口类 import java.io.File; import java.util.ArrayList; import java.util.List; import org.json.J ...
- SQL 左外连接查询 将右表中的多行变为左表的一列或多列
示例: --行列互转 /**************************************************************************************** ...
- laravel利用subquery使左连接查询右表数据唯一查询
如:表a,连接表b,b中有多条符合查询的记录 1.建立需要的子查询 $sub = DB::table('b')->select(['aid'])->selectRaw('max(id) a ...
- sql server中的左连接与右连接的简便写法
左连接 *=(左表中的数据全部显示出来,右表中没有相关联的数据显示null) select Users.*,Department.name as DepartmentName from Users,D ...
- mysql左连接右连接(查询两张表不同的数据)
有两张表:一张A表he一张B表 left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 :right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录: ...
- mysql中的左连接右连接内连接
一. 初始化SQL语句 /*join 建表语句*/ drop database if exists test; create database test; use test; /* 左表t1*/ dr ...
- Python进阶----多表查询(内连,左连,右连), 子查询(in,带比较运算符)
Python进阶----多表查询(内连,左连,右连), 子查询(in,带比较运算符) 一丶多表查询 多表连接查询的应用场景: 连接是关系数据库模型的主要特点,也是区别于其他 ...
- c++中的左值与右值
左值(lvalue)和右值(rvalue)是 c/c++ 中一个比较晦涩基础的概念,不少写了很久c/c++的人甚至没有听过这个名字,但这个概念到了 c++11 后却变得十分重要,它们是理解 move/ ...
随机推荐
- 企业架构研究总结(25)——TOGAF架构开发方法(ADM)之迁移规划阶段
1.8 迁移规划(Migration Planning) 企业架构开发方法各阶段——迁移规划 1.8.1 目标 本阶段的目标是: 确保实施和迁移规划与企业中各种管理框架相协调. 通过对每个进行中的成本 ...
- CSS border-radius 圆角
本文转自:http://www.kwstu.com/Admin/ViewArticle/201409151549476225 border-radius属性主要用于设置div圆角效果. 使用方法 bo ...
- OpenCascade简介
OpenCascade简介 Overview of OpenCascade Library eryar@163.com 摘要Abstract:对OpenCascade库的功能及其实现做简要介绍. ...
- SubSonic3.0配置及使用
SubSonic3.0配置及使用 SubSonic is A Super High-fidelity Batman Utility Belt that works up your Data Acces ...
- Left 、right join使用笔记
用过很多次left join,right join,看到查询出的结果,知道可能是没用left join.或者right join导致的结果,但都是用一次,网上查一次使用规则,学到的东西只是皮毛.今天用 ...
- openlayers 加载瓦片详解 一
在这先说点题外话,本人在研究webgl 三维球过程中惊人发现,openlayers 的开发人员也在研究webgl并经证实他们也正在研发基于 webgl的三维gis开源平台,这可能是首个开源的三维平台, ...
- [C++STDlib基础]关于C标准输入输出的操作——C++标准库头文件<cstdio>
网上实例 总结 /* _STD_BEGIN using _CSTD clearerr; using _CSTD fclose; using _CSTD feof; using _CSTD ferror ...
- Java集成开发环境--Eclipse for J2EE配置JRE运行环境
.d1 { border-style: none } .d2 { border-style: solid } .d3 { border-style: dotted } .d4 { border-sty ...
- CSS align-content 属性
实例 对齐弹性盒的 <div> 元素的各项: div { display: flex; flex-flow: row wrap; align-content:space-around; } ...
- Array类型方法总结(未写完)
转换方法: toString() toLocaleString() valueOf() 栈方法: push()---在数组末尾添加项,返回修改后的长度, pop()---在数组末尾移除项,返 ...