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. Ubuntu 16.04通过Trickle限制某个软件的下载/上传速度

    在Linux下没有Windows使用360那样去限制某个软件的速度. 但是通过Trickle可以设置某个软件的网速,但是前提是通过Trickle命令连带启动这个软件才可以,不能中途去设置. 比如现在很 ...

  2. 字段not null属性要放在最后面写,最少在类型后面写

    报错:create table test2211(id not null bigint ,age timestamp); 正确写法:create table test2211(id bigint no ...

  3. MVC WebApi 将返回值改为JSON格式

    新增一个类: public class BrowserJsonFormatter : JsonMediaTypeFormatter { public BrowserJsonFormatter() { ...

  4. Android: 关于百度地图缩放级别

    18 ~ 3 {"50m","100m","200m","500m","1km","2km ...

  5. Python3基础(十一) 类的拓展

    在类的初印象中,我们已经简单的介绍了类,包括类的定义.类对象和实例对象.本文将进一步学习类的继承.迭代器.发生器等等. 一.类的继承 单继承 派生类的定义如下: class DerivedClassN ...

  6. 从一个input点击引起的思考

    一个input或者select标签都是有属于自己的disabled属性的,这个属性很少被使用,但是我们在项目实际开发的过程中也会遇到,比如我选择之后就让他置灰不可以变动了,那么久可利用js动态设置.对 ...

  7. jvm 堆内存 栈内存 大小设置

                        4种方式配置不同作用域的jvm的堆栈内存. 1.Eclise 中设置jvm内存: 改动eclipse的配置文件,对全部project都起作用 改动eclipse ...

  8. Android面试题1

    1.Android中intent的是? 答:实现界面间的切换,能够包括动作和动作数据.连接四大组件的纽带. 2.SAX解析xml文件的长处的是? 答:不用事先调入整个文档,占用资源少 3.在andro ...

  9. [android]Xutils具体介绍

    什么是Xutils xUtils 包括了非常多有用的android工具,xUtils 源于Afinal框架,对Afinal进行了大量重构,使得xUtils支持大文件上传,更全面的http请求协议支持, ...

  10. 继承自TWinControl的控件不能在设计期间接受子控件,用代码设置子控件却可以(它的自绘是直接改写PaintWindow虚函数,而不是覆盖Paint函数——对TWinControl.WMPaint又有新解了)

    这个控件直接继承自TWinControl,因此不是改写Paint;函数,而是直接改写PaintWindow虚函数,它在VCL框架里被直接调用,直接就把自己画好了(不用走给控件Perform(WM_Pa ...