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