The new root node of zTree and then the new child node reAsyncChildNodes do not take effect solution

The newly added root node of zTree and then the new child node reAsyncChildNodes does not take effect. Solution,

The new root node of zTree cannot be refreshed asynchronously, and reAsyncChildNodes does not take effect. Solution,

reAsyncChildNodes not working solution

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

©Copyright Sweet Potato Yao July 28, 2017

http://fanshuyao.iteye.com/

1. Problem description:

When a root node is added, a child node (submenu) is added, and it is found that although reAsyncChildNodes is used to enter asynchronous refresh:

 

treeMenu.reAsyncChildNodes(node, "refresh", false)

 But it doesn't work at all because no asynchronous refresh request is sent to the server at all, why is that? How to solve it?

 

 

2. Solutions

The fundamental reason is that after the new root node is taken out and rendered on the page, because there are no child nodes below, the attribute isParent of the root node is still false, and the reAsyncChildNodes method is only valid for the root node, to be precise, the isParent attribute for the node and is valid when true.

 

The root node above has no child nodes at the beginning, so the isParent property is false at the beginning, and even if reAsyncChildNodes is called, it will not send an update request to the server.

 

The solution is to set the isParent property of the root node to true before calling the reAsyncChildNodes method.

node.isParent = true;//Turn the attribute to true so that this node is considered the root node
treeMenu.reAsyncChildNodes(node, "refresh", false);

 

Then the problem is solved, there is no final.

 

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

©Copyright Sweet Potato Yao July 28, 2017

http://fanshuyao.iteye.com/

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327040919&siteId=291194637