How can I rename a jsTree node

前端 未结 3 980
时光取名叫无心
时光取名叫无心 2021-02-18 22:09

I am not talking about $(\"#demo1\").jstree(\"rename\",node) which makes the node editable for the user. I am talking about the name being changed within the code.

3条回答
  •  梦谈多话
    2021-02-18 22:42

    You should turn on the switch to allow the rename operation, such as:

    $('#container').jstree({
        'core' : {
            'check_callback' : function (operation, node, node_parent, node_position, more) {
                // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node'
                // in case of 'rename_node' node_position is filled with the new node name
                return operation === 'rename_node' ? true : false;
            }
    
    });
    

提交回复
热议问题