Show the plus sign before the TreeView node when loading the TreeView dynamically

Source: Internet
Author: User

Explain the next headline, where I get the data through webservice and load it dynamically into the TreeView node. Then it is not a child node until a node is expanded. Then it does not display the plus sign. This causes the user to mistakenly assume that the node cannot be expanded. I do this, each time you create a node A, the default is that it creates a child node B (just give a name, if it is "hehe"), then the creation of Node A will have child node B, will also show the plus sign, and so on, and then expand Node A, and then remove the child Node B, which was created just before, The deletion method is to infer whether the expanded node A has a child node and the name is "hehe". If it is true, delete it.

Of course, this leads to a small problem, because the webservice I call is only able to fetch each level of TreeNode layer by level, so let's assume that the above method is used. To the last layer of the node. The plus sign is still displayed before this node. The solution I'm thinking of is to call the service to infer if the node has child nodes before this node is expanded, and if so, create a default child node for it. Suppose you don't create a default child node, but it's too expensive to invoke a service when you expand. If the great God thought of the solution to the problem, please enlighten me.


Show the plus sign before the TreeView node when loading the TreeView dynamically

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.