JSTREE生成树
来源:互联网 发布:win7恢复网络设置方法 编辑:程序博客网 时间:2024/06/07 16:33
在列表中需要树状列表,考虑后使用jstree生成
(function(){ jstree = $('#jstree').jstree({ "core" : { "animation" : 0, "check_callback" : true, "themes" : { "stripes" : true }, "data" : { "url" : function (node) { return ctx+"/sz/list"; }, "data" : function (node) { return { "id" : node.id }; }, }}, "types" : { "file" : { "icon" : "glyphicon glyphicon-user", "valid_children" : [] } } }); $('#jstree').bind("activate_node.jstree", function (obj, e) { var menuText = e.node.text; if(menuText){menuUserName=menuText;} }); $('#jstree').bind("ready.jstree", function (obj, e) { //该事件未树加载完成后执行事件,具体参考jstreeAPI });除此生成以外:
设置选择和去除选中状态
$('#jstree').jstree('select_node', menuUserName_id[glxss]);
$('#jstree').jstree('deselect_node',menuUserName_id[glxss]);
jstree 官网有详细的api 请查看
后台数据库的list 封装的model
import java.io.Serializable;/** * Created by cxj on 2017/2/7. */public class JsTree implements Serializable{ private String icon; private String type; private String id; private String parent; private String text; public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getParent() { return parent; } public void setParent(String parent) { this.parent = parent; } public String getText() { return text; } public void setText(String text) { this.text = text; } @Override public String toString() { return "JsTree{" + "id=" + id + ", parent='" + parent + '\'' + ", text='" + text + '\'' + '}'; } public JsTree(String id, String parent, String text) { this.id = id; this.parent = parent; this.text = text; this.icon="icon-user"; //默认图标 this.type="default"; }}
0 0
- JSTREE生成树
- jstree 展开树
- jstree
- JSTree
- jstree
- jstree
- JSTree
- jsTree
- jstree中json data 的生成
- jstree学习使用构建树
- 无限递归目录生成 json格式数据, jstree数据源
- golang生成目录嵌套json使用jstree显示
- JQuery树插件JSTree的使用
- 使用jstree自定义下拉菜单树组件
- Jquery树之jsTree----左右联动
- jsTree ajax 获取json数据加载树
- jstree -- 使用JSON 数据组装成树
- jstree--AJAX 请求获取数据形成树
- 虚拟机设置-NAT共享主机外网
- java.lang.UnsatisfiedLinkError解决方法汇集(转载)
- 8.4贪心法
- 样式的继承性和层叠性
- Quick Sort and Random Quick Sort
- JSTREE生成树
- LeetCode Summary Sort
- 寒假学习之stm32(15)----DMA(direct memory access)
- Java中文转Unicode码
- BZOJ 4556 [HEOI 2016] str
- android文本框左右加减按钮长按一直加减
- mysql 减少group by 的开销
- JQery实现Checkbox至少保证有一个选中
- LeetCode Summary STL Stack Queue