Home > database >  Pb12 a treeview type data in the question of the window
Pb12 a treeview type data in the question of the window

Time:10-10

Database to store a tree structure, the subtree of the tree layer depth, maximum depth is 4 layer, fiddling with the 2 days didn't realize the treeview, using a recursive is realized, but because of large amount of data, recursion is a bit slow, customers are not satisfied, the same data with the data window is much faster, so want to use the treeview data window implementation, please guide the great god, the data table structure is as follows,

The serial number at the corresponding level higher number title
1 0 great-grandfather
Grandfather 2 1
3 2 father
4 3 son
5 0 great-grandfather uncle
6 5 great-uncle
7 0 was uncle
8 7 great-uncle
9 8 uncle

CodePudding user response:

PFC is good thing that is punctuated with treeviw, or layered retrieval

CodePudding user response:

For consistent processing deep layer (there is no problem, the difficulty lies in the deep layer, some had no sons, some no grandson, deep layer ranged from 2 to 4 layers,

CodePudding user response:

I have been using PFC, PFC is can support different levels of, as long as a premise, the level is limited.

CodePudding user response:

 
//generated new tree list
Of_setbase (true)
Of_setlevelsource (true)
Ib_rmbmenu=false

The integer li_rc
Long ll_firstitemonlevel, ll_count
String ls_msg

//the first layer
Li_rc=this. Inv_levelsource. Of_Register (& amp;
1, "category", "', the sqlca, 'select ~' ~ 'as the category of' all classification," ")

If li_rc & lt;> 1 then
Ls_msg='first layer set wrong! '
Goto err_exit
End the if

Li_rc=this. Inv_levelsource. Of_SetPictureColumn (1, "1")
Li_rc=this. Inv_levelsource. Of_SetSelectedPictureColumn (1, "1")

//the second
Li_rc=this. Inv_levelsource. Of_Register (& amp;
2, "category", "'," ds_d_category_1 SQLCA, "")

If li_rc & lt;> 1 then
Ls_msg='second set wrong! '
Goto err_exit
End the if

Li_rc=this. Inv_levelsource. Of_SetPictureColumn (2, "2")
Li_rc=this. Inv_levelsource. Of_SetSelectedPictureColumn (2, "2")
//
//the third layer
Li_rc=this. Inv_levelsource. Of_Register (& amp;
3, "category", ": the parent. 1. Categorycode", "ds_d_category_2", the SQLCA, "")

If li_rc & lt;> 1 then
Ls_msg='the third set wrong! '
Goto err_exit
End the if

Li_rc=this. Inv_levelsource. Of_SetPictureColumn (3, "3")
Li_rc=this. Inv_levelsource. Of_SetSelectedPictureColumn (3, "3")

//layer 4
Li_rc=this. Inv_levelsource. Of_Register (& amp;
4, "category", ": the parent. 1. Categorycode", "ds_d_category_3", the SQLCA, "")

If li_rc & lt;> 1 then
Ls_msg='the third set wrong! '
Goto err_exit
End the if

Li_rc=this. Inv_levelsource. Of_SetPictureColumn (4, "4")
Li_rc=this. Inv_levelsource. Of_SetSelectedPictureColumn (4, "4")

//the fifth layer
Li_rc=this. Inv_levelsource. Of_Register (& amp;
5, "category", ": the parent. 1. Categorycode", "ds_d_category_4", the SQLCA, "")

If li_rc & lt;> 1 then
Set up error ls_msg='on the fourth floor! '
Goto err_exit
End the if

Li_rc=this. Inv_levelsource. Of_SetPictureColumn (5, "5")
Li_rc=this. Inv_levelsource. Of_SetSelectedPictureColumn (5, "5")


Li_rc=this. The event pfc_populate (0)

Ll_firstitemonlevel=this. Inv_base. Of_FindFirstItemLevel (1, 0)
Enclosing ExpandItem (ll_FirstItemOnLevel)
Enclosing SelectItem (ll_firstitemonlevel)

CodePudding user response:

Ok, go to study, thanked first!
  • Related