jsTree 插件
html代码
<div id="jstree1"></div>
js代码:
<script src="__STATIC__/h5/js/jquery.min.js?v=2.1.4"></script>
<script src="https://static.jstree.com/3.3.5/assets/dist/jstree.min.js"></script>
<script>
$(document).ready(function () {
$('#jstree1').jstree({
'core' : {
"animation" : ,
"check_callback" : true,
'force_text' : true,
"themes" : { "stripes" : true },
'data' : {
//"url" : "//www.jstree.com/fiddle/?lazy",
"url":"{:url('img/imgFolder/jsTree')}",
"dataType" : "json",
"data" : function (node) {
return { "id" : node.id }; }
}
},
"plugins" : [ "contextmenu", "dnd", "search", "state", "types", "wholerow" ]
}); }); function demo_create() {
var ref = $('#jstree1').jstree(true), sel = ref.get_selected();
if(!sel.length) { return false; }
sel = sel[];
sel = ref.create_node(sel, {"type":"file"});
if(sel) {
ref.edit(sel);
}
};
function demo_rename() {
var ref = $('#jstree1').jstree(true),
sel = ref.get_selected();
if(!sel.length) { return false; }
sel = sel[];
ref.edit(sel); };
function demo_delete(){
var ref = $('#jstree1').jstree(true),
sel = ref.get_selected();
if(!sel.length) { return false; }
ref.delete_node(sel); //$("#1").remove();
console.log(sel) ref.set_text(, ''); }
</script>
其中data数据格式
$('#jstree1').jstree({ 'core' : {
'data' : [
{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" }
]
} });
jsTree 插件的更多相关文章
- 利用jstree插件轻松构建树应用
最近完成了项目中的一个树状应用,第一次接触了jstree这个插件,总的来说它的官方文档还是比较详细的,但是在使用过程中还是出现了一些问题,下面我就来谈谈这款插件的使用和心得. 首先项目需要构建一棵树, ...
- jsTree插件简介(三)
UI-plugin JSTree的UI插件:用来处理选择.不选和鼠标悬浮树选项的插件. 一.属性包括: 1.select_limit:指定一次可以选中几个节点,默认为-1,表示无限制选中. 2.sel ...
- jquery jstree 插件的使用
最近一个项目 需要用到jstree 这个jQuery插件,就研究了下,做目录树 菜单还是很强大的,下面对经常会用到几个用法做下说明. 1. 首先页面 引用 jquery.jstree 2. html ...
- 【笔记】jstree插件的基本使用
官网地址:https://www.jstree.com/ json返回参数格式:推荐第二种方式 不需要在重新拼接返回格式 不刷新页面重新初始化 jstree时使用:$.jstree.destroy() ...
- jstree 插件的使用笔记(一)
官方:http://www.jstree.com/ 一.节点的描述 官方资料:http://www.jstree.com/docs/json/ 格式一 { id : "string&quo ...
- JQuery 目录树jsTree插件用法
PHP循环构造目录树结构 <ul> <php> function digui($fid,$level){ $class=M("wangpan_class") ...
- jsTree 插件Ajax数据
完整代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta ...
- 基于Metronic的Bootstrap开发框架经验总结(3)--下拉列表Select2插件的使用
在上篇<基于Metronic的Bootstrap开发框架经验总结(2)--列表分页处理和插件JSTree的使用>介绍了数据的分页处理,使用了Bootstrap Paginator插件,另外 ...
- (转)基于Metronic的Bootstrap开发框架经验总结(3)--下拉列表Select2插件的使用
http://www.cnblogs.com/wuhuacong/p/4761637.html 在上篇<基于Metronic的Bootstrap开发框架经验总结(2)--列表分页处理和插件JST ...
随机推荐
- 02-老马jQuery教程-jQuery事件处理
1. 绑定简单事件 在DOM中DOM0级绑定事件的方式是直接给事件属性赋值,但是这样有个缺点就是每次指定的事件处理程序会把之前的覆盖掉. jQuery简单绑定事件的方式,可以让我绑定多个事件处理程序跟 ...
- oracle中for循环
DECLARE );-- 定义一个字符串变量str BEGIN .. loop -- INSERT INTO FW_TEST(NAME) VALUES('bbb' + i);DECODE('1','' ...
- 7. 集成学习(Ensemble Learning)Stacking
1. 集成学习(Ensemble Learning)原理 2. 集成学习(Ensemble Learning)Bagging 3. 集成学习(Ensemble Learning)随机森林(Random ...
- Linux 下Tomcat服务器响应越来越慢分分析
本文转自自:https://www.cnblogs.com/yangc/p/6859985.html ,感谢给我提供提供思路. 服务器响应慢的分析与解决(Linux服务器) 一.分析思路 1.排除本机 ...
- [转] javaweb学习-jstl-<c:forEach>中 varStatus的属性简介
原文地址:http://blog.csdn.net/u010648555/article/details/51093277 varStatus是<c:forEach>jstl循环标签的一个 ...
- 【oneday_onepage】——The Secret Of Steve<2>
Sales + Customers = Nothing Broken is the formula for corporate cyanide. Most big companies that die ...
- Redis的内存回收机制
Redis的内存回收机制 2018年01月16日 17:11:48 chs007chs 阅读数:1172 Redis的内存回收机制主要体现在一下两个方面: 删除过期时间的键对象 删除过期键对象 : ...
- Java设计模式(6)桥模式(Bridge模式)
Bridge定义:将抽象和行为划分开来,各自独立,但能动态的结合. 为什么使用桥模式 通常,当一个抽象类或接口有多个具体实现(concrete subclass),这些concrete之间关系可能有以 ...
- [maven] settings 文件 本地maven仓库
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Soft ...
- Ogre Compositor解析
Compositor脚本与类型 我们先看下面一张基本的Compositor的脚本图: 上面就是一个Composition资源.在解析时,主要是使用CompositionPass, Compositio ...