Jstree 点击重命名问题

Jstree onclick rename problem

本文关键字:问题 重命名 Jstree      更新时间:2023-09-26

我正在使用jstree读取我保存在localStorage中的xml文件。对于 jstree 的大多数功能,它工作得很好,但我无法弄清楚如何就地编辑节点,只需单击标签即可。我尝试对我拥有的标签进行

  • 点击事件出价,但无法将重命名顺序发送到 JStree函数;

    这是我所拥有的,但它不起作用,请帮助我。

    $(target).jstree({ 
    "themes": {
    "theme": "classic", 
    "icons":false,
    "dots":true 
    },
    "core": { 
    "initially_open": [ "#hide" ],
    "animation": 300 
    }, 
    "plugins": [ "themes", "html_data","dnd","crrm" ], 
    "callback": { 
        "ondblclk": "function(n){alert()}"
    }
    });
    
  • 试试这个,它是一个标准绑定函数

    .bind("rename.jstree", function (e, data) {
            $.post(
                "./server.php", 
                { 
                    "operation" : "rename_node", 
                    "id" : data.rslt.obj.attr("id").replace("node_",""),
                    "title" : data.rslt.new_name
                }, 
                function (r) {
                    if(!r.status) {
                        $.jstree.rollback(data.rlbk);
                    }
                }
            );
        })