jsTree的checkbox默认选中和隐藏
jstree复选框自定义显示隐藏和初始化默认选中
首先需要配置 Checkbox plugin
"plugins" : ['checkbox']
设置默认选中状态(checkbox 选中)
state: {checked: true}
$.jstree.defaults.checkbox.tie_selection
示例:
$('#demo_tree').jstree({
"core" : {
'data': [
{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node", state: {checked: true}},
{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
]
},
"plugins" : ['checkbox'],
"checkbox" : {
"tie_selection": false,
}
});
jstree复选框自定义显示隐藏
jstree 本身不支持在节点中隐藏 checkbox,国外有个大佬给出一个利用 css 来隐藏的解决方案:
首先来一段 css
.no_checkbox>i.jstree-checkbox{display:none}
然后在 data 的 json 数据结构中
$('#demo_tree').jstree({
"core" : {
'data': [
{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node", state: {checked: true}},
{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" , a_attr: {class: "no_checkbox"}},
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
]
},
"plugins" : ['checkbox'],
});
效果:
jstree version => 3.3.8
参考:
https://stackoverflow.com/questions/6112567/jstree-hide-checkbox
jsTree的checkbox默认选中和隐藏的更多相关文章
- jQuery设置 select、radio、checkbox 默认选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 关于在layui中的table checkbox 默认选中设置
一.layui版本 layui-v2.4.5 二.设置table的checkbox默认选中 总共有两种方法: 方法1:在返回的json中设置LAY_CHECKED为true,页面上的checkbox就 ...
- Jstree 使用CheckBox插件 选中父节点时被禁用的子节点也会选中问题
问题描述: 最近用jstree遇到一个问题,使用CheckBox插件时,当父节点选中时,被禁用的子节点也会选中如下 解决方案: 1. 将jstree升级到最新的版本,v3.3.4及以上就可以 2. ...
- 在ng-repeat内Checkbox默认选中
Angularjs的ng-repeat是用来循环产生呈现数据. 当我们需要在ng-repeat循环中呈现一系列Checkbox时,某些checkbox选项是默认选中的. 在ASP.NET MVC程序中 ...
- checkbox默认选中
http://www.ggfenxiang8.com/?page_id=1108 需要最新前端视频教程vu.js1.0/2.0等的可以叫我QQ1139721002
- ligerUI---ligerGrid默认选中checkbox
写在前面: ligerGrid中是可以带有checkbox(前面有可以选择打勾勾的框框)的,对于checkbox默认选中 这次项目中也要做,因为一个系统的增删改查,在修改一条数据的时候,是需要对原来的 ...
- jquert 判断checkbox 是否选中
<input type="checkbox" id="IsEnable" /> 在调试的时候,会出现,一直未true的状态,不管是选中还是未选中 解 ...
- JS 判断checkbox 是否选中
<input type="checkbox" id="IsEnable" /> 在调试的时候,会出现,一直未true的状态,不管是选中还是未选中 解 ...
- freemarker中修改和添加功能中包含checkbox复选框默认选中需求的解决方式
今天做的公司ERP系统上线第一天内部使用的,各种BUG铺天盖地,[虽然只是技术总监一个人在测试……],其中有一个就是其中部门管理页面中的修改和添加功能 一个人做一套ERP总是有点疏漏的,虽然里面的东西 ...
随机推荐
- JS实现“隐藏与显示”功能(多种方法)
1,通过按钮实现隐藏与显示: 这个是通过按钮点击实现的隐藏与显示,具体代码如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...
- 三、linux环境的搭建1(oracle、ssh、jdk、mysql、samba、tomcat)
linux环境的搭建1(oracle.ssh.jdk.mysql.samba.tomcat) 网络配置 方案一 tip 1 使用ifconfig : ifconfig eth0 新ip 然后编辑/ ...
- C语言strcat()函数:字符串连接(拼接)
C语言strcat()函数:字符串连接(拼接) C语言 strcat() 函数用来将两个字符串连接(拼接)起来. 头文件:string.h 语法/原型: char*strcat(char* str ...
- Selenium(Webdriver)自动化测试常问问题
http://blog.sina.com.cn/s/blog_c189e2590102w3bv.html Selenium(Webdriver)自动化测试常问问题 (1)selenium中如何保证操作 ...
- POJ3122 Pie(二分)
题目链接:http://poj.org/problem?id=3122 题意:一堆人分蛋糕,每人蛋糕大小一样,求最大能分多少,蛋糕必须是整块整块的,不能两块拼一起.然后注意输入F个人最后要分F+1份. ...
- rf关键字
1.获取字典中的key ${b} Set Variable ${a}[0][dealer_buy_price] Log ${b} 2.${b}的float类型转换string 再和后面比较 Sho ...
- sql 根据两点经纬度算出两点之间距离
select (sqrt( ( ((121.544685-longitude)*PI()*12656*cos(((31.134857+latitude)/2)*PI()/180)/180) * ((1 ...
- strtotime中的一些坑
monday: 获取到的时间戳是下一个周一,如果当天是周一则获取到当天. last monday:获取上一个周一时间戳,如果当天是周一获取到的也是上一个周一时间戳. next monday:获取下一个 ...
- java8 四大核心函数式接口Function、Consumer、Supplier、Predicate(转载)
Function<T, R> T:入参类型,R:出参类型 调用方法:R apply(T t); 定义函数示例:Function<Integer, Integer> func = ...
- MVC5+EF6 入门完整教程5 :UI的一些改造
https://www.cnblogs.com/miro/p/4095165.html 上篇文章介绍了EF实现CRUD及一些基本的Html Helpers. 这次我们将会对之前的内容进行一些修改和重构 ...