javascript - jstree don't add new node -


I have just copied the demo code from the site of jstree and tried to add the option of the new node. There is no error but do not add this node.

This is my code:

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; JsTree test & lt; / Title & gt; & Lt ;! - Load 2 theme css files - & gt; & Lt; Link rel = "stylesheet" href = "dist / themes / default / style.min.css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt ;! - 3 one container element setup - & gt; & Lt; Div id = "jstree" & gt; & Lt ;! - In this example, the tree is populated with inline HTML - & gt; & Lt; Ul & gt; & Lt; Li & gt; Root node 1 & lt; Ul & gt; & Lt; Li id = "child_node_1" & gt; Hair node 1 & lt; / Li & gt; & Lt; Li & gt; Child node 2 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; Root node 2 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Button & gt; Demo Button & lt; / Button & gt; & Lt ;! - 4 contains the jQuery library - & gt; & Lt; Script src = "dist / libs / jquery.js" & gt; & Lt; / Script & gt; & Lt ;! - 5 contains minified jstree source - & gt; & Lt; Script src = "dist / jstree.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; $ (Function () {// 6. Create an example when DOM is ready $ ('# jstree'). Jstree (); // is associated with events triggered on tree $ ('# jstree') On (" Changed. ", Function (e, data) {console.log (data.selected);}); 8 / interact with tree - either the path is fine $ ('button'). ('Click' , Function () {$ ('# Jstree'). Jstree (true) .select_node ('child_node_1'); //$('#jstree').jstree().create_node(null, 'AAA', 'Lo' ); $ ('# Jstree') $ $ ('# jstree'), $ ("j1_3"), "after", {"data": "hello" select_node ',' child_node_1 '); $ .jstree.reference ('# Jstree'). Select_node ('child_node_1');})}}); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

View the comments that have been done, but there is no error, but there is no idea about adding a new node.

Try it ..

  $ ('# Jstree' ). Jstree ("create_node", "parent_id", function (e, data) {console.log ('hi', data);});  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -