easyui中combotree加载数据处理
来源:互联网 发布:周立功单片机笔试题目 编辑:程序博客网 时间:2024/05/16 23:55
前台js处理:
$('#drugClass').combotree({ valueField: 'id', textField: 'text', method: 'get', animate: true, editable:'true', mode:'remote', url: '/service/drug-price/find', onSelect: function (row) { $("#drugCode").combogrid('clear'); var classCode = row.id; $.get(basePath + "/drug-price/findDrugDictByClass?classCode=" + classCode + "&orgId=" + config.org_Id, function (data) { //定义药品名称 $("#drugCode").combogrid("grid").datagrid("loadData", data); }); }})
后台处理数据:
@GET@Path("find")public List<CombotreeUntils> LinqJson() { String parientId = null; List<CombotreeUntils> list = LinqJsonTree(parientId); return list;}//查询并且构建combotree的数据public List<CombotreeUntils> LinqJsonTree(String parientId) { List<DrugClassDict> drugClassDicts = null; List<CombotreeUntils> jsonData = new ArrayList<CombotreeUntils>();//判断药品的代码是否为2位 if (StringUtils.isNotBlank(parientId) && parientId.length() == 2) { drugClassDicts = drugClassDictApi.findClassDictByParentId(parientId); }else{ drugClassDicts = drugClassDictApi.findClassDictByParentId("*"); } CombotreeUntils combotreeUntils = null; for (int i = 0; i < drugClassDicts.size(); i++) { combotreeUntils = new CombotreeUntils(); combotreeUntils.setId(drugClassDicts.get(i).getClassCode()); combotreeUntils.setText(drugClassDicts.get(i).getClassName()); combotreeUntils.setState("closed"); //在加载出全部数据后,将节点关闭 if (drugClassDicts.get(i).getClassCode().length() == 5) { combotreeUntils.setChildren(new ArrayList<CombotreeUntils>()); } else { combotreeUntils.setChildren(LinqJsonTree(drugClassDicts.get(i).getClassCode())); } jsonData.add(combotreeUntils); } return jsonData;}所用到的类:
public class CombotreeUntils { public String id; public String text; public List<CombotreeUntils> children ; public String parentId ; public String state; public String getState() { return state; } public void setState(String state) { this.state = state; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public List<CombotreeUntils> getChildren() { return children; } public void setChildren(List<CombotreeUntils> children) { this.children = children; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; }}easyui中combotree所需要用到的数据格式为:
{"id":1,"text":"My Documents","children":[{"id":11,"text":"Photos","state":"closed","children":[{"id":111,"text":"Friend"},{"id":112,"text":"Wife"},{"id":113,"text":"Company"}]},{"id":12,"text":"Program Files","children":[{"id":121,"text":"Intel"},{"id":122,"text":"Java","attributes":{"p1":"Custom Attribute1","p2":"Custom Attribute2"}},{"id":123,"text":"Microsoft Office"},{"id":124,"text":"Games","checked":true}]},{"id":13,"text":"index.html"},{"id":14,"text":"about.html"},{"id":15,"text":"welcome.html"}]}]
1 0
- easyui中combotree加载数据处理
- easyui combotree --异步加载
- easyui中combotree与combobox并用动态加载数据
- easyui combotree 加载本地数据
- easyui combotree加载字典数据
- easyUi combotree 实现动态加载树节点
- easyUi combotree 实现动态加载树节点
- easyui combotree 异步加载节点 默认值 问题
- easyui combotree加载静态前台json问题
- easyUI ComboTree
- EasyUI combotree
- Easyui combotree
- 如何实现jquery easyui combotree 下拉加载默认选中
- 【easyui】combotree类似combobox模糊查询功能,动态加载数据
- easyui combotree加载静态数据问题(选不上)
- EasyUI-tree和combotree异步加载数据自定义查询参数
- 实现jquery Easyui中combotree,combobox控件的动态选中
- EasyUI 中combotree 默认不能选择父节点
- AutoLayout VFL 笔记
- mysql数据库读写分离
- Rorr:Operation category READ is not supported in state standy
- 在Servlet中实现重定向
- 西安80坐标系转换工具
- easyui中combotree加载数据处理
- 在Activity中响应ListView内部按钮的点击事件的两种方法
- 机器学习分类篇-支持向量机下
- 高光谱图像分类(二)稀疏表示
- Java 面试知识总结
- MySQL:实践过的一些杂乱记录
- [SGD]--Optimization(SGD, Momentum, Adagrad, Adadelta)
- python通过MySQLdb操纵mysql
- 将log4j的输出等级调整到Dubug出现的问题