在jstree的contextmenu之外动态重命名树节点 [英] Renaming a tree node dynamically outside of contextmenu in jstree

查看:247
本文介绍了在jstree的contextmenu之外动态重命名树节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码在contextmenu之外的jstree中成功创建了一个新的树节点.我的问题是如何在上下文菜单之外以类似方式动态重命名树节点中的文本?是否可以调用.jstree("rename" ....)函数来完成此任务?非常感谢!

I use the code below to successfully create a new tree node in jstree outside of contextmenu. My question is how can you dynamically RENAME the text in a tree node in a similar manner outside of the contextmenu? Is there a .jstree("rename" ....) function that can be called to accomplish this? Much appreciated!

$("#RequirementsTree").jstree("create", null, "last", {"data" : "new_node_text",
                  "state" : "open",
                  "attr" :  { "id" : "new_node_id", "name" : "requirement" }, 
 });

我尝试了以下操作:

        .bind("select_node.jstree", function(event, data) {
            ReqNode = data.rslt;

 $("#RequirementsTree").rename_node(ReqNode, "test");

但是,那没有用.我在做错什么吗?

That didn't work, however. Is there something I'm doing wrong?

推荐答案

我正在使用jsTree 1.0-rc3版本.下面的语法对我有用:

I'm using jsTree 1.0-rc3 version. The syntax below worked for me:

 $('#companyFields_tree').jstree('rename_node', '#0', 'testNewName' );

这篇关于在jstree的contextmenu之外动态重命名树节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆