jstree中文github文档

jstree

Bala...bala...这段就不翻译了.
jstree就是个基于JQUERY的树形控件.

jsTree is jquery plugin, that provides interactive trees. It is absolutely free, open source and distributed under the MIT license.

jsTree is easily extendable, themable and configurable, it supports HTML & JSON data sources, AJAX & async callback loading.

jsTree functions properly in either box-model (content-box or border-box), can be loaded as an AMD module, and has a built in mobile theme for responsive design, that can easily be customized. It uses jQuery’s event system, so binding callbacks on various events in the tree is familiar and easy.

You also get(更多功能):
* drag & drop support(拖放)
* keyboard navigation(键盘导航)
* inline edit, create and delete(行内增、删、改)
* tri-state checkboxes(checkbox图标)
* fuzzy searching (模糊搜索)
* customizable node types(定义节点类型)

除了这个readme文件外,更多的信息请前往jstree.com 或者 the discussion group.



新手入门

引入脚本

需要引入3个脚本文件:
1. jQuery (>= 1.9.1)
2. 一个jstree主题 (默认只有一个主题)
3. jstree资源文件

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.3/themes/default/style.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.3/jstree.min.js"></script>

If you decide to host jstree yourself - the files are located in the dist folder. You can safely ignore the dist/libs folder.


用html标签定义树

最简单的定义方法是用写死在HTML中.你只需要用jquery选择要渲染成jstree的dom元素,然后调用 .jstree()渲染就可以了。 也可以用 $.jstree.create(element) 的方式渲染。

<div id="container">
  <ul>
    <li>Root node
      <ul>
        <li>Child node 1</li>
        <li>Child node 2</li>
      </ul>
    </li>
  </ul>
</div>
<script>
$(function() {
    
  $('#container').jstree();
});
</script>

查看代码执行结果

jstree支持用data-*属性来设置选项:

<li data-jstree='{ "selected" : true, "opened" : true }'>Root node ...

用js数组或者JSON格式定义树

HTML定义方法比较简单, 但不够灵活,所以提供了更为灵活的JS方法:

<div id="container"></div>
<script>
$(function() {
    
  $('#container').jstree({
    'core' : {
      'data' : [
        { "text" : "Root node", "children" : [
            { "text" : "Child node 1" },
            { "text" : "Child node 2" }
          ]
        }
      ]
    }
  });
});
</script>

查看代码执行结果

与前面HTML的例子不同的是, 往.jstree() 传入一个config对象参数.

注意了,jstree会试图解析core.data 定义的任何数据,用来构造成树节点。如果不设置core.data属性,jstree就会试着解析HTML的树节点.

JSON数据的固定格式

提供的JSON数据必须符合一定的格式, 每个对

  • 24
    点赞
  • 57
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
对于学习 PixiJS 和 Three.js 的资料,以下是一些推荐的资源: PixiJS: 1. 官方文档:PixiJS 官方网站提供了详细的文档,包含了教程、示例和 API 参考。你可以在这里找到所有需要的信息:https://pixijs.io/documentation/ 2. PixiJS 学习路径:CSDN 上有一个名为 "Pixi.js 实战教程" 的系列文章,涵盖了从入门到进阶的内容。你可以在这里找到相关的教程:https://blog.csdn.net/column/details/25287.html 3. Github 示例项目:PixiJS 的官方 Github 存储库中有一些示例项目,可以帮助你学习和理解 PixiJS 的使用。你可以在这里找到这些示例:https://github.com/pixijs/examples Three.js: 1. 官方文档:Three.js 官方网站提供了详细的文档,包含了教程、示例和 API 参考。你可以在这里找到所有需要的信息:https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene 2. Three.js 学习路径:CSDN 上也有一个名为 "Three.js 实战教程" 的系列文章,涵盖了从入门到进阶的内容。你可以在这里找到相关的教程:https://blog.csdn.net/column/details/25288.html 3. Github 示例项目:Three.js 的官方 Github 存储库中有一些示例项目,可以帮助你学习和理解 Three.js 的使用。你可以在这里找到这些示例:https://github.com/mrdoob/three.js/tree/dev/examples 希望这些资源能帮助你开始学习 PixiJS 和 Three.js!如果有任何其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值