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. sql sever 等待事件

    http://blog.csdn.net/dba_huangzj/article/details/7607844

  2. 超简单的vue2.0分页组件

    1.组件代码 <template> <div class="pagination_comment_style" style="width: 100%;o ...

  3. Vue插槽的另外一些特性

    之前有个项目,想判断一下,某一个模板内的插槽是否被使用. 不知道是不是问题过于简单,网上没有这方面的说明.我就抽时间验证一下vue插槽相关的一些功能. 然后写下这篇随笔,希望对后来人能有一些帮助. 简 ...

  4. 在SpringMVC中,当Json序列化,反序列化失败的时候,会抛出HttpMessageNotReadableException异常, 当Bean validation失败的时候,会抛出MethodArgumentNotValidException异常,因此,只需要在ExceptionHandler类中添加处理对应异常的方法即可。

    在SpringMVC中,当Json序列化,反序列化失败的时候,会抛出HttpMessageNotReadableException异常, 当Bean validation失败的时候,会抛出Method ...

  5. BC #62 div1 02

    /* 数位DP题,设dp[n][k][j]为前n位最后一位是k时mod为j的个数.操作都相同,可以使用矩阵加速.本来对于每一位是7*10,可以把它压向一个向量. 加速矩阵为70*70,再加一维计算前缀 ...

  6. python supervisor进程监控工具的使用

    supervisor —— a process control system 另外一个类似 supervisor的工具,因为supervisor 不兼容python3, !!! Circus Proc ...

  7. uva 11212 - Editing a Book(迭代加深搜索 IDA*) 迭代加深搜索

    迭代加深搜索 自己看的时候第一遍更本就看不懂..是非常水,但智商捉急也是没有办法的事情. 好在有几个同学已经是做过了这道题而且对迭代加深搜索的思路有了一定的了解,所以在某些不理解的地方询问了一下他们的 ...

  8. OC-内存管理的一些要点

    创建一个BOOK对象,对其属性进行声明 定义. @property 属性声明 定义了对属性的赋值 -(void) dealloc 方法在对象销毁的时候进行调用. #import <Foundat ...

  9. JavaScript设计模式 Item9 --适配器模式Adapter

    适配器模式(转换器面模式),通常是为要使用的接口,不符本应用或本系统使用,而需引入的中间适配层类或对象的情况. 适配器模式的作用是解决两个软件实体间的接口不兼容的问题. 一.定义 适配器模式(Adap ...

  10. hdu 4549 M斐波那契数列(矩阵高速幂,高速幂降幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=4549 f[0] = a^1*b^0%p,f[1] = a^0*b^1%p,f[2] = a^1*b^1%p... ...