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. Android 内存管理

    1.Activity中的对象生命周期勿大于Activity的生命周期.OOM演示样例代码例如以下: private static Drawable sBackground; @Override pro ...

  2. excel 补全全部空格

    首先全选列或者选中某列,按F5键.再按"定位条件„"button,选择空值,这样就把全部列的空格选中了,然后直接输入"你想要替换的值",再按Ctrl + 回车

  3. Android SwipeToDismiss:左滑/右滑删除ListView条目Item

     <Android SwipeToDismiss:左右滑动删除ListView条目Item> Android的SwipeToDismiss是github上一个第三方开源框架(githu ...

  4. Windows 9立即公布了

    Windows 9技术预览版可能于今晚在美国旧金山举办的Windows公布会上宣布.下一代的Windows名称最有可能是Windows或Windows 9.网友猜想也可能是WIndows X或Wind ...

  5. C#反射发出System.Reflection.Emit学习

    一.System.Reflection.Emit概述 Emit,可以称为发出或者产生.与Emit相关的类基本都存在于System.Reflection.Emit命名空间下.反射,我们可以取得形如程序集 ...

  6. Jboss 7配置日志

    1. Jboss7配置日志理论知识介绍 Jboss 7日志能够在XML配置文件和日志管理属性文件内配置.默认日志配置在configuration文件夹的logging.properties文件内. 通 ...

  7. Linux I2C设备驱动编写(一)【转】

    本文转载自:http://blog.csdn.net/airk000/article/details/21345457 在Linux驱动中I2C系统中主要包含以下几个成员: I2C adapter 即 ...

  8. SQL SERVER 语句大全

    ·SQL的简单查询实例教程关键词:SQL语句大全 中文网 整理编辑,经典SQL语句大全(SQL语句大总结),欢迎网友投稿 下列语句部分是Mssql语句,不可以在access中使用.SQL分类:DDL— ...

  9. 怎么让frameset出现整体滚动条

    a.html<!DOCTYPE html> <html> <head> <title></title> </head> < ...

  10. centos6.4 ssh免密码登陆(只需三个步骤)

    学习Hadoop的时候,用到的.这里作为记录. 以下是最简洁的方式: 4台虚拟机: 用户:root.hadoop hostname 分别是:Master.Hadoop.Slave1.Hadoop.Sl ...