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_nodedeselect_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.

  • mixednode

    This 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.

  • mixednode

    This 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.

  • mixednode

    This can be a DOM node, jQuery node or selector pointing to an element within the tree.

  • booleanuncheck

    If set to true the node is unchecked, if set to false the node is checked, otherwise - the state is toggled.

.check_node ( node )

Checks a node.

  • mixednode

    This can be a DOM node, jQuery node or selector pointing to an element within the tree.

.uncheck_node ( node )

Unchecks a node.

  • mixednode

    This 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.

  • mixednode

    This 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.

  • mixedcontext

    This 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.

  • booleanget_all

    By 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.

jstree CHECKBOX PLUGIN的更多相关文章

  1. jsTree checkbox plugin使用笔记

    引入css文件 <link rel="stylesheet" type="text/css" href="js/assets/global/pl ...

  2. jsTree的checkbox默认选中和隐藏

    jstree复选框自定义显示隐藏和初始化默认选中 首先需要配置 Checkbox plugin "plugins" : ['checkbox'] 设置默认选中状态(checkbox ...

  3. JQuery/JS插件 jsTree加载树,普通加载,点一级加载一级

    前端: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <tit ...

  4. JQuery/JS插件 jsTree加载树,预先加载,初始化时加载前三级节点,当展开第三级节点时 就加载该节点下的所有子节点

    jsTree加载树, 初始化时 加载前三级节点, 当展开第三级节点时 就加载该节点下的所有子节点 html: <!DOCTYPE html> <html> <head&g ...

  5. 利用jstree插件轻松构建树应用

    最近完成了项目中的一个树状应用,第一次接触了jstree这个插件,总的来说它的官方文档还是比较详细的,但是在使用过程中还是出现了一些问题,下面我就来谈谈这款插件的使用和心得. 首先项目需要构建一棵树, ...

  6. jquery插件开发(checkbox全选的简单实例)

    html代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...

  7. JQuery 目录树jsTree插件用法

    PHP循环构造目录树结构 <ul> <php> function digui($fid,$level){ $class=M("wangpan_class") ...

  8. 无限分级和tree结构数据增删改【提供Demo下载】

    无限分级 很多时候我们不确定等级关系的层级,这个时候就需要用到无限分级了. 说到无限分级,又要扯到递归调用了.(据说频繁递归是很耗性能的),在此我们需要先设计好表机构,用来存储无限分级的数据.当然,以 ...

  9. Ultimate Facebook Messenger for Business Guide (Feb 2019)

    Ultimate Facebook Messenger for Business Guide (Updated: Feb 2019) By Iaroslav Kudritskiy November 2 ...

随机推荐

  1. tomcat上传图片失败

    今天,突然遇到个奇怪的问题,tomcat上传图片时好时坏,经查线上四台服务有一台服务器硬盘满了. 解决一下硬盘空间的问题,有好使了,那么图片上传通过流写到远程对象存储服务中,并没有落盘和硬盘满有哪些关 ...

  2. Spark之安装和使用

    Scala安装 Spark使用Scala开发,安装的Scala版本必须和Spark使用的版本一致,否则使用Scala编写的Spark任务会有兼容性问题 可以到Spark官网查看确定Scala版本,或者 ...

  3. C/C++ Threads): Creating worker threads that will be listening to jobs and executing them concurrently when wanted

    Suppose we have two workers. Each worker has an id of 0 and 1. Also suppose that we have jobs arrivi ...

  4. Oracle OCP之硬解析在共享池中获取内存锁的过程

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/38684819 1.获得library cache Latch (1)在父游标的名柄没有找到 ...

  5. Java创建和解析Json数据方法——org.json包的使用(转)

    org.json包的使用 1.简介   工具包org.json.jar,是一个轻量级的,JAVA下的json构造和解析工具包,它还包含JSON与XML, HTTP headers, Cookies, ...

  6. Android 自己定义Activity基类

    我们在开发App的时候有时候碰到多个界面有一个共同点的时候.比方,都有同样的TitleBar.而且TitleBar能够设置显示的文字.TitleBar上的点击事件,假设给每个Activity都写一遍T ...

  7. Java之正則表達式【使用语法】

    认为好就顶一个!! ! ! 3.正則表達式 用一些特殊的有意义的字符组成的字符串(死记) 原子:正則表達式的最基本组成单位 正則表達式特殊意义的字符:   .  *  +  ?不能单独表示它们,假设非 ...

  8. 最直观的poi的使用帮助(告诉你怎么使用poi的官网),操作word,excel,ppt

    最直观的poi的使用帮助(告诉你怎么使用poi的官网),poi操作word,excel,ppt 写在最前面 其实poi的官网上面有poi的各种类和接口的使用说明,还有非常详细的样例,所以照着这些样例来 ...

  9. JSP页面规格化

    http://doc.okbase.net/%E4%BA%BA%E7%94%9F%E9%9A%BE%E5%BE%97%E7%B3%8A%E6%B6%82/archive/123084.html htt ...

  10. IDEA Spark Streaming 操作(RDD队列流)

    import org.apache.spark.SparkConf import org.apache.spark.rdd.RDD import org.apache.spark.streaming. ...