Tree-type components layered loading data to realize ideas, improve speed, improve efficiency

Source: Internet
Author: User

we know that tree-shaped parts can show data in tree form. For example, we show organizations that can write business tables:
Select dept_id,dept_name,upper_id from Sa_dept_dict
then set the tree key column is not dept_id, the parent column is not upper_id. This will come out with a tree-type of data.

This is not a problem in the general business, if we imagine that there are thousands of data in the Sa_dept_dict table, so that directly read out to form a tree, the efficiency may be very slow. How to solve it better.

we know that because the tree can be a node expansion, it can first load the first level of data out, and then click on the first level of a certain value, and then the second level of the value of loading out, so that the point of a certain only load a direct subordinate, the amount of data is much less, the efficiency is very obvious.

For example: When you start the tree, only the first layer of data is queried.

Select dept_id,dept_name,upper_id from sa_dept_dict where upper_id =0

then, in the data row double-click event for the tree part, write the following code.


DimDT= tree-Part 1. DataTable

If-Tree Part 1. Treelist.focusednode.nodes.count=0 Then
' Loads the child data of the selection node. and fill in the tree-type parts, to achieve hierarchical loading data.
Dim dt1=executeselect ("Select dept_id,dept_name,upper_id from Sa_dept_dict where upper_id=" & Tree-type Part 1. Getfocusednodevalue ("dept_id"))
For each Dr inDT1.Rows
DT. Rows.Add (Dr. ItemArray)
Next
End If


this realizes the layered loading data, we can try, the larger the amount of data, the more obvious the effect. For example, after a total of tens of thousands of data, it is necessary to load data hierarchically.

Original address: http://bbs.delit.cn/thread-871-1-1.html

Reprint please indicate the source:

Author: metric Technology http://www.delit.cn

Tree-type components layered loading data to realize ideas, improve speed, improve efficiency

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.