代码之家  ›  专栏  ›  技术社区  ›  Shereef Marzouk

DevExpress TreeList不显示子节点,而是显示为根节点

  •  0
  • Shereef Marzouk  · 技术社区  · 9 年前

    我有一个 TreeList List(Of LedgerAccountEntry)() .

    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
    

    这些只是相关部分。如果你需要更多信息,请告诉我。

    结果是没有子节点的扁平树,我检查了ID是否存在,并且是否正确返回。

    1 回复  |  直到 9 年前
        1
  •  1
  •   nempoBu4    9 年前

    这是因为您正在使用 ParentLedgerAccountSys 作为字段。您需要转换 父分类帐系统 属性或添加代表您的 父分类帐系统 领域
    以下是示例:

    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