First Version with Template Config from Database
This commit is contained in:
@@ -3,26 +3,19 @@ Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared
|
||||
Imports MultiTool.Shared.Constants
|
||||
|
||||
Public Class GridLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
Private ReadOnly TemplateConfig As Winline.Configuration
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pTemplateConfig As Winline.Configuration)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
TemplateConfig = pTemplateConfig
|
||||
End Sub
|
||||
|
||||
Public Function GetGridFromElement(pGrid As GridControl, pTable As Schemas.Schema.Table) As GridControl
|
||||
Dim oInvisibleColumns As New List(Of String) From {
|
||||
"BELEGKEY",
|
||||
"Zeilennummer",
|
||||
"Belegart",
|
||||
"Infotext",
|
||||
"Leistungsdatum",
|
||||
"Projektnummer",
|
||||
"Auftragsreferenz",
|
||||
"Laufnummer"
|
||||
}
|
||||
|
||||
pGrid.Name = pTable.Name
|
||||
pGrid.ForceInitialize()
|
||||
pGrid.MainView.PopulateColumns()
|
||||
@@ -32,11 +25,16 @@ Public Class GridLoader
|
||||
oView.OptionsBehavior.Editable = False
|
||||
|
||||
For Each oCol In pTable.Columns
|
||||
Dim oVisibleIndex As Integer = 0
|
||||
Dim oVisibleIndex As Integer
|
||||
|
||||
' Hide certain columns
|
||||
If oInvisibleColumns.Contains(oCol.Name) Then
|
||||
oVisibleIndex = -1
|
||||
If oCol.Config IsNot Nothing Then
|
||||
If oCol.Config.IsVisible = False Then
|
||||
oVisibleIndex = -1
|
||||
Else
|
||||
oVisibleIndex = oCol.Config.OrderKey
|
||||
End If
|
||||
Else
|
||||
oVisibleIndex = 0
|
||||
End If
|
||||
|
||||
Dim oColumn = New Columns.GridColumn With {
|
||||
@@ -48,7 +46,6 @@ Public Class GridLoader
|
||||
}
|
||||
|
||||
oView.Columns.Add(oColumn)
|
||||
|
||||
Next
|
||||
|
||||
oView.BestFitColumns()
|
||||
@@ -64,20 +61,21 @@ Public Class GridLoader
|
||||
|
||||
Private Function GetColumnType(pColumn As Schemas.Schema.Column)
|
||||
Select Case pColumn.DataType
|
||||
Case MultiTool.Shared.Constants.ColumnType.Boolean
|
||||
Case ColumnType.Boolean
|
||||
Return DevExpress.Data.UnboundColumnType.Boolean
|
||||
|
||||
Case MultiTool.Shared.Constants.ColumnType.Date
|
||||
Case ColumnType.Date
|
||||
Return DevExpress.Data.UnboundColumnType.DateTime
|
||||
|
||||
Case MultiTool.Shared.Constants.ColumnType.Integer
|
||||
Case ColumnType.Integer
|
||||
Return DevExpress.Data.UnboundColumnType.Integer
|
||||
|
||||
Case MultiTool.Shared.Constants.ColumnType.Decimal
|
||||
Case ColumnType.Decimal
|
||||
Return DevExpress.Data.UnboundColumnType.Decimal
|
||||
|
||||
Case Else
|
||||
Return DevExpress.Data.UnboundColumnType.String
|
||||
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user