jstree CHECKBOX PLUGIN
The checkbox
plugin makes multiselection possible using three-state checkboxes.
Configuration
override_ui
A boolean. Default is false
.
If set to true
all selection will be handled by checkboxes. The checkbox plugin will map UI's get_selected function to its ownget_checked function and overwrite the UI reselect function. It will also disable the select_node
, deselect_node
anddeselect_all
functions. If left as false
nodes can be selected and checked independently.
checked_parent_open
A Boolean. Default is true
.
When set to true
when programatically checking a node in the tree all of its closed parents are opened automatically.
two_state
A boolean. Default is false
.
If set to true
checkboxes will be two-state only, meaning that you will be able to select parent and children independently and there will be no undetermined state.
real_checkboxes
A boolean. Default is false
.
If set to true
real hidden checkboxes will be created for each element, so if the tree is part of a form, checked nodes will be submitted automatically. By default the name of the checkbox is "check_" + the ID of the LI element
and the value is 1
, this can be changed using the real_checkboxes_names
config option.
real_checkboxes_names
A function. Default is function (n) { return [("check_" + (n[0].id || Math.ceil(Math.random() * 10000))), 1]; }
.
If real checkboxes are used this function is invoked in the current tree's scope for each new checkbox that is created. It receives a single argument - the node that will contain the checkbox. The function must return an array consisting of two values - the name for the checkbox and the value for the checkbox.
Demos
Using the checkbox plugin - all you need to do is include it in the list of active plugins.
1 |
$( function () { |
2 |
$( "#demo1" ).jstree({ |
3 |
"plugins" : [ "themes" , "html_data" , "checkbox" , "sort" , "ui" ] |
4 |
}); |
5 |
}); |
API
._prepare_checkboxes ( node )
Inserts the checkbox icons on the node. Used internally.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
._repair_state ( node )
Repairs the checkbox state inside the node. Used internally.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
.change_state ( node , uncheck )
Changes the state of a node. Used mostly internally - you'd be better off using the check_node
and uncheck_node
functions. Triggers an event.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
boolean
uncheckIf set to
true
the node is unchecked, if set tofalse
the node is checked, otherwise - the state is toggled.
.check_node ( node )
Checks a node.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
.uncheck_node ( node )
Unchecks a node.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
.check_all ( )
Checks all nodes.
.uncheck_all ( )
Unchecks all nodes.
.is_checked ( node )
Checks if a node is checked. Returns boolean.
mixed
nodeThis can be a DOM node, jQuery node or selector pointing to an element within the tree.
.get_checked ( context, get_all ), .get_unchecked ( context, get_all )
Both functions return jQuery collections.
mixed
contextThis can be a DOM node, jQuery node or selector pointing to an element within the tree. If specified only nodes inside the specified context are returned, otherwise the whole tree is searched.
boolean
get_allBy default these functions return only top level checked/unchecked nodes (if a node is checked its children are note returned), if this parameter is set to
true
they will return all checked/unchecked nodes.
.show_checkboxes ( ), .hide_checkboxes ( )
Show or hide the checkbox icons.
最新文章
- eclipse添加js,html,jsp编辑输入补充提示
- sql server常用语法点
- 关于使用jacob出现的异常
- WPF ListView 选中问题
- 3xian之所在(转)
- android面试题(转)
- PHP 中的随机数——你觉得可靠么?
- zend studio使用入门
- ios创建画笔的样例(双笔画效果)
- x86_64是什么意思
- 【Android Developers Training】 27. 序言:和其它应用交互
- Exp3免杀原理与实践 20164312 马孝涛
- 分类器、logistic回归
- C# 类库中添加注释方法
- linklist和arraylist区别
- 动态调试|Maccms SQL 注入分析(附注入盲注脚本)
- Linq中datetime的处理以及asp.net下拉列表控件的selectitem,text等的设置显示处理
- FCC JS基础算法题(3):Find the Longest Word in a String (找出最长单词)
- 【原】ActiveMq实现分布式事务一致性
- 使用verdaccio 搭建npm私有仓库
热门文章
- Spring关于使用注解@Configuration去配置FormattingConversionServiceFactoryBean来实现自定义格式字符串处理无效的问题(未找到是什么原因造成的)
- 用JQuery实现选中select里面的option显示对应的div
- Linux网络编程:UDP实现可靠的文件传输
- cocos2D(七)---- CCScene
- jdk1.6下使用sardine和jackrabbit-webdav的问题
- 5分钟Serverless实践 | 构建无服务器图片鉴黄Web应用
- mysql20170410练习代码+笔记
- 树的遍历 迭代算法——思路:初始化stack,pop stack利用pop的node,push new node to stack,可以考虑迭代一颗树 因为后序遍历最后还要要访问根结点一次,所以要访问根结点两次是难点
- Kubernetes——基于容器技术的分布式架构领先方案,它的目标是管理跨多个主机的容器,提供基本的部署,维护以及运用伸缩
- go语言笔记——还是大爱的我的python,开发效果高,tornado的性能也很不错