jj 21.10 master detail view
This commit is contained in:
@@ -170,7 +170,51 @@ Public Class ClassWindreamDocGrid
|
|||||||
Try
|
Try
|
||||||
clonedTable.Load(DT_RESULT.CreateDataReader())
|
clonedTable.Load(DT_RESULT.CreateDataReader())
|
||||||
DT_RESULT = clonedTable
|
DT_RESULT = clonedTable
|
||||||
gridView.GridControl.DataSource = DT_RESULT
|
|
||||||
|
' Neues Dataset für Master- und Detail-Tabelle erstellen
|
||||||
|
Dim ds As New DataSet()
|
||||||
|
|
||||||
|
' Detail Tabelle mit dummy Spalten erstellen
|
||||||
|
Dim DT_DETAILS As New DataTable("DETAILS")
|
||||||
|
DT_DETAILS.Columns.Add("docId", GetType(String))
|
||||||
|
DT_DETAILS.Columns.Add("Value", GetType(String))
|
||||||
|
|
||||||
|
' Ein paar Rows hinzufügen, docId verweist auf Master-Tabelle
|
||||||
|
DT_DETAILS.Rows.Add(220768, "test")
|
||||||
|
DT_DETAILS.Rows.Add(220768, "haha")
|
||||||
|
DT_DETAILS.Rows.Add(220777, "test1")
|
||||||
|
DT_DETAILS.Rows.Add(220777, "test2")
|
||||||
|
DT_DETAILS.Rows.Add(220777, "test3")
|
||||||
|
DT_DETAILS.Rows.Add(220778, "test2")
|
||||||
|
|
||||||
|
' Tabellen zum DataSet hinzufügen
|
||||||
|
ds.Tables.Add(DT_RESULT)
|
||||||
|
ds.Tables.Add(DT_DETAILS)
|
||||||
|
|
||||||
|
' Relation `docIdDetails` erstellen
|
||||||
|
Dim keyColumn As DataColumn = ds.Tables(0).Columns("docId")
|
||||||
|
Dim foreignColumn As DataColumn = ds.Tables(1).Columns("docId")
|
||||||
|
ds.Relations.Add("docIdDetails", keyColumn, foreignColumn)
|
||||||
|
|
||||||
|
Dim gridControl As GridControl = gridView.GridControl
|
||||||
|
|
||||||
|
' Datasource auf Master-Tabelle setzen
|
||||||
|
'gridView.GridControl.DataSource = DT_RESULT
|
||||||
|
gridControl.DataSource = ds.Tables(0)
|
||||||
|
gridControl.ForceInitialize()
|
||||||
|
|
||||||
|
' Detail View anlegen und der Relation `docIdDetails` zuweisen
|
||||||
|
Dim grvwDetail As New GridView(gridControl)
|
||||||
|
grvwDetail.OptionsBehavior.Editable = False
|
||||||
|
grvwDetail.OptionsView.ShowGroupPanel = False
|
||||||
|
grvwDetail.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D
|
||||||
|
grvwDetail.OptionsView.EnableAppearanceEvenRow = True
|
||||||
|
grvwDetail.Appearance.EvenRow.BackColor = Color.Aqua
|
||||||
|
grvwDetail.Appearance.HeaderPanel.BackColor = Color.Aqua
|
||||||
|
grvwDetail.Appearance.HeaderPanel.Options.UseBackColor = True
|
||||||
|
|
||||||
|
|
||||||
|
gridControl.LevelTree.Nodes.Add("docIdDetails", grvwDetail)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ClassLogger.Add(">> Attention: Could not load converted datatable DocSearch: " & ex.Message, False)
|
ClassLogger.Add(">> Attention: Could not load converted datatable DocSearch: " & ex.Message, False)
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Reference in New Issue
Block a user