When there are no leaf nodes under the root node, a new child node is added and the node is refreshed without success (the node is not refreshed, but has been successfully inserted)
Because the Ztree.reasyncchildnodes method is only valid for the root node, which is accurate when the Isparent property of the node is true, when a new node is added under the leaf node, the Isparent property of the original leaf node is false, so it does not trigger Reasyncchil Dnodes This method, we need to change the Isparent property of the node to true before triggering the method to call.
New node code for generic root node:
var ztree=$.fn.ztree.getztreeobj ("Restree");
var node=ztree.getselectednodes ();
var pnode=node[0].getparentnode ();
Ztree.reasyncchildnodes (Pnode, "refresh", false);
New child node code for leaf node:
var ztree=$.fn.ztree.getztreeobj ("Restree");
var node=ztree.getselectednodes ();
var node1=node[0];
Node1.isparent = true;//turns the attribute to true so that the node is considered to be the root node
Ztree.reasyncchildnodes (Node1, "refresh", false);
This makes it possible to successfully implement an asynchronous flush.