資料庫里存盤了一個樹結構,這個樹的子樹層深不同,最大深度是4層,擺弄了2天還是沒有實作treeview。用遞回倒是實作了,無奈資料量大,遞回有點慢,客戶不滿意。同樣的資料用資料視窗快很多,所以想用treeview資料窗實作。請大神們指點迷津。資料表結構如下。
本級序號 上級序號 標題
1 0 曾祖父
2 1 祖父
3 2 父親
4 3 兒子
5 0 曾祖伯父
6 5 伯祖父
7 0 曾叔父
8 7 叔祖父
9 8 堂叔
uj5u.com熱心網友回復:
pfc是好東西,里邊有treeviw,還是分層檢索的uj5u.com熱心網友回復:
對于層深一致的處理沒有問題,這次的難點在于層深不一致,有的沒有兒子,有的沒有孫子。層深從2層到4層不等。uj5u.com熱心網友回復:
我是一直用pfc,pfc是能支持不等層級的。只要一個前提,層次是有限的。uj5u.com熱心網友回復:
// 生成新的樹形串列
of_setbase(true)
of_setlevelsource(true)
ib_rmbmenu = false
integer li_rc
long ll_firstitemonlevel,ll_count
string ls_msg
// 第一層
li_rc = this.inv_levelsource.of_Register(&
1, "category",'', sqlca, 'select ~'所有分類~' as category ' ,"")
if li_rc <> 1 then
ls_msg = '第一層設定錯誤!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(1, "1")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(1, "1")
// 第二層
li_rc = this.inv_levelsource.of_Register(&
2, "category",'', "ds_d_category_1", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第二層設定錯誤!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(2, "2")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(2, "2")
//
// 第三層
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "ds_d_category_2", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三層設定錯誤!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(3, "3")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(3, "3")
// 第四層
li_rc = this.inv_levelsource.of_Register(&
4, "category", ":parent.1.categorycode", "ds_d_category_3", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三層設定錯誤!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(4, "4")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(4, "4")
// 第五層
li_rc = this.inv_levelsource.of_Register(&
5, "category", ":parent.1.categorycode", "ds_d_category_4", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第四層設定錯誤!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(5, "5")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(5, "5")
li_rc = this.event pfc_populate(0)
ll_firstitemonlevel = this.inv_base.of_FindFirstItemLevel(1, 0)
this.ExpandItem(ll_FirstItemOnLevel)
this.SelectItem(ll_firstitemonlevel)
uj5u.com熱心網友回復:
好的,馬上去研究下。先行謝過!轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/14726.html
標籤:基礎類
上一篇:oracle鏈接問題
