DevExpress TreeList不显示子节点,而是显示为根节点 [英] DevExpress TreeList not displaying child nodes and displaying as root nodes instead
本文介绍了DevExpress TreeList不显示子节点,而是显示为根节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从List(Of LedgerAccountEntry)()
中读取了TreeList
.
Public Class LedgerAccountEntry
Public Property LedgerAccountSys() As Integer
Public ParentLedgerAccountSys As Integer
'
'
' ETC
End Class
表单加载:
tlLedgerAccounts.ParentFieldName = "ParentLedgerAccountSys"
tlLedgerAccounts.KeyFieldName = "LedgerAccountSys"
tlLedgerAccounts.RootValue = -1
稍后:
While bla
entry.LedgerAccountSys = rstAccounts("LedgerAccountSys").Value
entry.ParentLedgerAccountSys = IIf(rstAccounts("ParentLedgerAccountSys").Value Is DBNull.Value, -1, rstAccounts("ParentLedgerAccountSys").Value)
lst.add(entry)
End While
tlLedgerAccounts.DataSource = lst
这些只是相关的部分.如果您需要更多信息,请告诉我.
These are just the relevant parts. Please let me know if you need more info.
结果是没有子节点的扁平树,我检查了ID是否存在并已正确返回.
The result is flat tree with no child nodes, I checked that the IDs exists and are being returned correctly.
推荐答案
这是因为您将ParentLedgerAccountSys
用作字段.您需要将ParentLedgerAccountSys
转换为属性,或添加另一个表示您的ParentLedgerAccountSys
字段的属性.
这是示例:
This is because you are using ParentLedgerAccountSys
as field. You need to convert your ParentLedgerAccountSys
to property or add another property which represents your ParentLedgerAccountSys
field.
Here is example:
Public Class LedgerAccountEntry
Public Property LedgerAccountSys As Integer
'Public ParentLedgerAccountSys As Integer <-- Here is field.
Public Property ParentLedgerAccountSys As Integer '<-- Here is property instead of field.
'
'
' ETC
End Class
这篇关于DevExpress TreeList不显示子节点,而是显示为根节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文