$ ("#jqTree"). Jstree ({//This example is only part of the function that remains to be optimized for the place"Json_data" : { "Ajax" : { ' type ': ' Get ', //"Cache": false,"url": "URL of request JSON", "Data":function(n) {//parameters passed to the background return { "OrgID": N.attr? N.ATTR ("id"). Replace ("Node_", ""): 0//The OrgID here is the name of the parameter I passed to the backstage. }; }, "Success":function(data) {//The parameters returned in the background, due to the parameters returned in the background Jstree parse, vardataarray=NewArray ();//so I'm going to spell the array of objects that Jstree can parse and return directly$.each (Data.orglist,function(i,item) {varjsonobj={"Data": {"title": Item.name},"attr": {"id": Item.id}}; if(item.type!= "Student") {//student identification is a leaf nodeJsonobj.state= "Closed";//This is the value that identifies whether this node has child nodes.} dataarray.push (Jsonobj); }); returnDataArray; } } }, "Themes": {"theme": "Default", "dots":false, "Icons":false }, "Plugins": ["Themes", "Json_data", "checkbox", "CRRM"]}). Delegate ("A", "click",function(Event, data) {Event.preventdefault ();});//this sentence is changed in the node a tag of the default execution Jstree on the demo has
View Code
"Jstree" asynchronously loads JSON node data 004