How can I rename a jsTree node

前端 未结 3 982
时光取名叫无心
时光取名叫无心 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:41

    I believe there is an syntax error with respect to the square braces "[" in the above answer. I use jsTree 3.0.4 and this is the correct syntax -

    right -    $("#demo1").jstree('set_text',node,text);
    wrong -    $("#demo1").jstree('rename_node', [node , text] );    
    
    Example - 
    $("#tree_3").jstree('set_text',"#idSelectorForNode" ,"NewName");
    

提交回复
热议问题