jstree初始化

<script type="text/javascript">
//对节点初始化
$(function () {
// All those configuration options are documented in the _docs folder
$("#demo")
.jstree({
core : {
animation : 1 //折叠速度
},//点击节点获取子节点
"core" : { "initially_open" : [ "root2" ] },
"html_data" : {
"data" : '<%=htmlSegment%>',
"ajax" : {
"url" : "ajaxFacture.do?libName=<%=libName%>&libId=<%=libId%>&libVersion=<%=libVersion%>",
cache : false,
async : true,//动态加载数据
"data" : function (n) {
return { id : n.attr ? n.attr("id") : 0 }; } } },

"themes" : {

"theme" : "default",
"dots" : false, //隐藏图标
"icons" : true
},
"plugins" : [ "themes", "html_data","dnd","contextmenu","crrm" ,"checkbox"]

})//绑定删除事件
.bind("remove.jstree", function (e, data) {
data.rslt.obj.each(function () {

$.ajax({
async : false,
type: 'POST',
url: "NaviUtilServlet.do",
data :
{
"type" : "remove",
"id" : this.id.replace("node_",""),
"libv" : $("#libVersion").val(),
"libid" : $("#libId").val()
},
success : function(falg){
if(falg == "false"){
alert("删除失败!");
}}});});
})//绑定修改节点名称事件
.bind("rename.jstree", function (e, data) {
$.ajax({
async : false,
type: 'POST',
url: "NaviUtilServlet.do",
data :
{
"type" : "rename",
"id" : data.rslt.obj.attr("id").replace("node_",""),
"libv" : data.rslt.obj.attr("libv").replace("node_",""),
"libid" : data.rslt.obj.attr("libid").replace("node_",""),
"nodeName" : data.rslt.new_name
},
success : function(falg){
if(falg == "false"){
alert("修改名称失败!");
}}});
})//绑定移动节点事件
.bind("move_node.jstree", function (e, data) {
data.rslt.o.each(function () {
//目标节点
var targetTopicId = data.rslt.np.attr("id").replace("node_","");
//下一个兄弟节点
var nextId = $(this).next("li").attr("id");
if(nextId == "undefined"){
nextId = "";
}
if(targetTopicId == "demo"){
targetTopicId = "";
}

$.ajax({
async : false,
type: 'POST',
url: "NaviUtilServlet.do",
data :
{
"type" : "drag",
"id" : $(this).attr("id").replace("node_",""),
"libv" : $(this).attr("libv"),
"libid" : $(this).attr("libid"),
"nextId" : nextId,
"targetTopicId" : targetTopicId
},
success : function(falg){
if(falg == "false"){
alert("拖动失败!");
}}})});});});
</script>
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值