2 Commits

Author SHA1 Message Date
Developer01
4898d25388 Berechnung Spalten start 2026-02-10 17:40:15 +01:00
Developer01
c2b3c023b9 Merge in MAster 2026-02-10 13:05:24 +01:00
3 changed files with 38 additions and 56 deletions

View File

@@ -804,6 +804,7 @@ Public Class ClassControlCreator
Public Function GridTables_GetRepositoryItemForColumn(pColumnName As String, pDataTable As DataTable, pIsAdvancedLookup As Boolean) As RepositoryItem
If pIsAdvancedLookup Then
Dim oEditor = New RepositoryItemLookupControl3
If pDataTable IsNot Nothing Then
@@ -812,34 +813,18 @@ Public Class ClassControlCreator
oEditor.DataSource = pDataTable
End If
' Erlaube ungültige Werte (verhindert automatisches Löschen)
oEditor.NullText = "[Ungültiger Wert]"
oEditor.ShowFooter = False
oEditor.AllowNullInput = DefaultBoolean.True
oEditor.ValidateOnEnterKey = True
' KRITISCH: Erlaube Texteingabe für ungültige Werte
oEditor.TextEditStyle = TextEditStyles.Standard
' Weitere Standard-Eigenschaften für LookupControl3
'oEditor.ImmediatePopup = False
Return oEditor
Else
Dim oEditor = New RepositoryItemComboBox()
Dim oItems As New List(Of String)
' KRITISCH: Erlaube Anzeige ungültiger Werte
oEditor.TextEditStyle = TextEditStyles.Standard ' Statt DisableTextEditor!
oEditor.AllowNullInput = DefaultBoolean.True
oEditor.ValidateOnEnterKey = True
AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs)
' Prüfe nur bei Änderung, nicht beim Anzeigen
If Not oItems.Contains(_sender.EditValue) AndAlso _sender.IsModified Then
If oItems.Contains(_sender.EditValue) Then
_e.Cancel = False
Else
_e.Cancel = True
_sender.ErrorText = "Ungültiger Wert - bitte neu auswählen"
End If
End Sub
If pDataTable IsNot Nothing Then
@@ -861,6 +846,7 @@ Public Class ClassControlCreator
Return oEditor
End If
End Function
Public Sub GridTables_HandleControlValueChange(pControlPanel As XtraScrollableControl, pColumnsWithSqlAndControlPlaceholders As DataTable)
If Not IsNothing(pColumnsWithSqlAndControlPlaceholders) AndAlso pColumnsWithSqlAndControlPlaceholders.Rows.Count > 0 Then
For Each oRow As DataRow In pColumnsWithSqlAndControlPlaceholders.Rows

View File

@@ -57,7 +57,16 @@ Namespace ControlCreator
Case Else
oColumn.DataType = GetType(String)
End Select
Dim oFormulaExpression = ObjectEx.NotNull(oRow.Item("FORMULA_EXPRESSION"), String.Empty)
If oFormulaExpression <> String.Empty Then
Try
oColumn.Expression = oFormulaExpression
oColumn.ReadOnly = True
Catch ex As Exception
_Logger.Warn("⚠️ Invalid FORMULA_EXPRESSION for column {0}: {1}", oColumn.ColumnName, oFormulaExpression)
_Logger.Error(ex)
End Try
End If
oDataTable.Columns.Add(oColumn)
Next
@@ -179,6 +188,13 @@ Namespace ControlCreator
Dim oReadOnlyInt As Integer
oIsReadOnly = Integer.TryParse(oReadOnlyValue.ToString(), oReadOnlyInt) AndAlso oReadOnlyInt = 1
End If
Dim oFormulaExpression = ObjectEx.NotNull(oColumnData.Item("FORMULA_EXPRESSION"), String.Empty)
If oFormulaExpression <> String.Empty Then
oIsReadOnly = True
End If
oCol.OptionsColumn.AllowEdit = Not oIsReadOnly
Dim oColumnType As String = oColumnData.Item("TYPE_COLUMN")
@@ -462,43 +478,23 @@ Namespace ControlCreator
isApplyingInheritedValue = True
Try
_Logger.Info(String.Format("Inherit Value is active for column. So inheritting the value [{0}]...", valueToApply))
For dataIndex As Integer = listIndex + 1 To pView.DataRowCount - 1
Dim targetHandle = pView.GetRowHandle(dataIndex)
If targetHandle = DevExpress.XtraGrid.GridControl.InvalidRowHandle OrElse pView.IsGroupRow(targetHandle) Then
Continue For
End If
' Batch-Update mit BeginUpdate/EndUpdate für bessere Performance
pView.BeginUpdate()
Try
For dataIndex As Integer = listIndex + 1 To pView.DataRowCount - 1
Dim targetHandle = pView.GetRowHandle(dataIndex)
If targetHandle = DevExpress.XtraGrid.GridControl.InvalidRowHandle OrElse pView.IsGroupRow(targetHandle) Then
Continue For
End If
If pView.IsNewItemRow(targetHandle) Then
Exit For
End If
If pView.IsNewItemRow(targetHandle) Then
Exit For
End If
Dim existingValue = pView.GetRowCellValue(targetHandle, pArgs.Column.FieldName)
If Equals(existingValue, valueToApply) Then
Continue For
End If
pView.SetRowCellValue(targetHandle, pArgs.Column.FieldName, valueToApply)
Next
' WICHTIG: Nach dem Setzen der Werte die Spalte neu zeichnen
pView.LayoutChanged()
' Nur die betroffene Spalte invalidieren (effizienter als alle Zeilen)
For dataIndex As Integer = listIndex + 1 To pView.DataRowCount - 1
Dim targetHandle = pView.GetRowHandle(dataIndex)
If targetHandle <> DevExpress.XtraGrid.GridControl.InvalidRowHandle AndAlso Not pView.IsNewItemRow(targetHandle) Then
pView.InvalidateRowCell(targetHandle, pArgs.Column)
End If
Next
Finally
pView.EndUpdate()
End Try
Dim existingValue = pView.GetRowCellValue(targetHandle, pArgs.Column.FieldName)
If Equals(existingValue, valueToApply) Then
Continue For
End If
pView.SetRowCellValue(targetHandle, pArgs.Column.FieldName, valueToApply)
Next
Finally
isApplyingInheritedValue = False
End Try

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.8.0.0")>
<Assembly: AssemblyVersion("2.7.9.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguage("")>