0

那里。我是一家制造公司的内部 Vb.net 程序员。这是一家中小企业。我正在使用 devexpress vb.net 升级 COA(会计科目表),具体来说,我利用树列表组件来显示 COA。

不幸的是,该组件并未汇总所有节点。

如果有人可以帮助我,我真的很感激。

我已经创建了一个简短版本的 COA 显示 VB.net 代码和一个已执行表单的屏幕截图。

Imports DevExpress.Data

Public Class Form1
    Dim DataTable1 As New DataTable

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        DataTable1.Columns.Add("NodeIDParent", GetType(String))
        DataTable1.Columns.Add("NodeID", GetType(String))
        DataTable1.Columns.Add("NodeName", GetType(String))
        DataTable1.Columns.Add("NodeValue", GetType(Integer))

        DataTable1.Rows.Add("", "01", "Node One", 0)

        DataTable1.Rows.Add("01", "03", "Node One One", 0)
        DataTable1.Rows.Add("03", "07", "Node One One One", 0)
        DataTable1.Rows.Add("07", "08", "Node One One One One", 6)
        DataTable1.Rows.Add("07", "09", "Node One One One Two", 7)
        DataTable1.Rows.Add("07", "10", "Node One One One Tree", 8)

        DataTable1.Rows.Add("01", "04", "Node One Two", 0)
        DataTable1.Rows.Add("04", "05", "Node One Two One", 2)
        DataTable1.Rows.Add("04", "06", "Node One Two Two", 5)

        DataTable1.Rows.Add("", "02", "Node Two", 0)

        With TreeList1
            .DataSource = DataTable1

            .OptionsView.ShowRowFooterSummary = True
            .Columns("NodeValue").RowFooterSummary = SummaryItemType.Sum

            .OptionsView.ShowSummaryFooter = True
            .Columns("NodeValue").SummaryFooter = SummaryItemType.Sum

            .Columns("NodeValue").AllNodesSummary = True

            .ParentFieldName = "NodeIDParent"
            .KeyFieldName = "NodeID"
        End With
    End Sub
End Class

在此处输入图像描述

4

1 回答 1

0

试试这个代码:

 Dim item As GridGroupSummaryItem = New GridGroupSummaryItem()
        item.FieldName = Grid.Columns("NodeValue").FieldName
        item.SummaryType = DevExpress.Data.SummaryItemType.Sum
        item.ShowInGroupColumnFooter = Grid.Columns("NodeValue")
        item.DisplayFormat = "{0:#,##0.00}"

 Grid.GroupSummary.Add(item)
于 2017-05-15T13:05:01.843 回答