在使用Dev的treelist的過程中遇到了一個糟心的事,綁定好數據源,設置完KeyFieldName和ParentFieldName
DataTable dtPublictree = pADOHelper.GetDataTable("SELECT * from " + CommonClass.tableTreePublic + " where c_appid = '" + strAppID + "'order by i_order asc,c_name desc");//order by c_code
treeList1.DataSource = dtPublictree;
treeList1.KeyFieldName = "i_id";
treeList1.ParentFieldName = "i_pid";
但是!死活顯示不了層級
百度到心累,終於在一篇博客裏找到了線索:TreeList不顯示分級列表---Dev踩坑記
改完字段類型
alter table pt_webapps_tree_public_t alter COLUMN i_pid type int8 using i_pid::int8 ;
完美顯示:
失之毫釐差之千里,僅僅是int8和int4的區別,結果造成這麼個問題。謹記!!