jj: refetch checked values for checkable grid when filter is cleared. don't act on refresh in onSelectionChange.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
Imports System.Windows.Forms
|
Imports System.Windows.Forms
|
||||||
Imports System.Text.RegularExpressions
|
Imports System.Text.RegularExpressions
|
||||||
|
Imports DevExpress.XtraGrid
|
||||||
|
Imports DevExpress.XtraGrid.Views.Grid
|
||||||
|
|
||||||
Public Class ClassControlBuilder
|
Public Class ClassControlBuilder
|
||||||
Private _master_panel As Panel
|
Private _master_panel As Panel
|
||||||
@@ -496,8 +498,8 @@ Public Class ClassControlBuilder
|
|||||||
' Hier werden nun evtl schon gesetzte Werte für CheckedListBox angehakt
|
' Hier werden nun evtl schon gesetzte Werte für CheckedListBox angehakt
|
||||||
' Wert per LINQ aus DT_ControlValues suchen der zur aktuellen controlId passt
|
' Wert per LINQ aus DT_ControlValues suchen der zur aktuellen controlId passt
|
||||||
Dim values As List(Of Object) = (From row1 In CURRENT_CONTROL_VALUES.AsEnumerable()
|
Dim values As List(Of Object) = (From row1 In CURRENT_CONTROL_VALUES.AsEnumerable()
|
||||||
Where row1.Item("CONTROL_ID") = dependingControlId
|
Where row1.Item("CONTROL_ID") = dependingControlId
|
||||||
Select row1.Item("VALUE")).ToList()
|
Select row1.Item("VALUE")).ToList()
|
||||||
|
|
||||||
ControlLoader.CheckedListBox.LoadValue(checkedlistbox, values)
|
ControlLoader.CheckedListBox.LoadValue(checkedlistbox, values)
|
||||||
If IsEdit Or IsInsert Then
|
If IsEdit Or IsInsert Then
|
||||||
@@ -555,8 +557,8 @@ Public Class ClassControlBuilder
|
|||||||
ControlLoader.DataGridViewCheckable.SetDataSource(gridControl, dt)
|
ControlLoader.DataGridViewCheckable.SetDataSource(gridControl, dt)
|
||||||
|
|
||||||
Dim values As List(Of Object) = (From row1 In CURRENT_CONTROL_VALUES.AsEnumerable()
|
Dim values As List(Of Object) = (From row1 In CURRENT_CONTROL_VALUES.AsEnumerable()
|
||||||
Where row1.Item("CONTROL_ID") = dependingControlId
|
Where row1.Item("CONTROL_ID") = dependingControlId
|
||||||
Select row1.Item("VALUE")).ToList()
|
Select row1.Item("VALUE")).ToList()
|
||||||
|
|
||||||
ControlLoader.DataGridViewCheckable.LoadValue(gridControl, values)
|
ControlLoader.DataGridViewCheckable.LoadValue(gridControl, values)
|
||||||
End Select
|
End Select
|
||||||
@@ -746,8 +748,8 @@ Public Class ClassControlBuilder
|
|||||||
Me.ControlsChanged.Remove(controlId)
|
Me.ControlsChanged.Remove(controlId)
|
||||||
|
|
||||||
Dim loadedValues As List(Of Object) = (From row In CURRENT_CONTROL_VALUES.AsEnumerable()
|
Dim loadedValues As List(Of Object) = (From row In CURRENT_CONTROL_VALUES.AsEnumerable()
|
||||||
Where row.Item("CONTROL_ID") = controlId
|
Where row.Item("CONTROL_ID") = controlId
|
||||||
Select row.Item("VALUE")).ToList()
|
Select row.Item("VALUE")).ToList()
|
||||||
|
|
||||||
ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_RECORD_ID, CONTROL_ID, control, loadedValues, CURRENT_ENTITY_ID)
|
ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_RECORD_ID, CONTROL_ID, control, loadedValues, CURRENT_ENTITY_ID)
|
||||||
RECORD_CHANGED = False
|
RECORD_CHANGED = False
|
||||||
@@ -765,7 +767,7 @@ Public Class ClassControlBuilder
|
|||||||
' CtrlCommandUI.SaveRecord(0, CURRENT_ENTITY_ID, CURRENT_PARENT_ID)
|
' CtrlCommandUI.SaveRecord(0, CURRENT_ENTITY_ID, CURRENT_PARENT_ID)
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
Dim CONTROL_VALUE As String = ClassControlCommandsUI.GetControlValue(control)
|
Dim CONTROL_VALUE As String = ClassControlCommandsUI.GetControlValue(control)
|
||||||
|
|
||||||
If CURRENT_CONTROL_VALUE_COUNT > 3 Then
|
If CURRENT_CONTROL_VALUE_COUNT > 3 Then
|
||||||
|
|
||||||
@@ -808,6 +810,9 @@ Public Class ClassControlBuilder
|
|||||||
Public Sub OnCheckedChanged(sender As Object, ByVal e As DevExpress.Data.SelectionChangedEventArgs)
|
Public Sub OnCheckedChanged(sender As Object, ByVal e As DevExpress.Data.SelectionChangedEventArgs)
|
||||||
If CURRENT_RECORD_ENABLED = False Then Exit Sub
|
If CURRENT_RECORD_ENABLED = False Then Exit Sub
|
||||||
If IsCancelCheck = True Then Exit Sub
|
If IsCancelCheck = True Then Exit Sub
|
||||||
|
' Wenn die aktion nicht Add oder Remove ist, wurde auch keine Checkbox angeklickt
|
||||||
|
' Dann auch nicht updaten
|
||||||
|
If e.Action = System.ComponentModel.CollectionChangeAction.Refresh Then Exit Sub
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim GridView As DevExpress.XtraGrid.Views.Grid.GridView = sender
|
Dim GridView As DevExpress.XtraGrid.Views.Grid.GridView = sender
|
||||||
@@ -891,6 +896,36 @@ Public Class ClassControlBuilder
|
|||||||
End If
|
End If
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub OnFilterChanged(sender As Object, e As EventArgs)
|
||||||
|
Dim gridView As GridView = sender
|
||||||
|
Dim filter = gridView.ActiveFilter
|
||||||
|
Dim controlId As Integer = DirectCast(gridView.GridControl.Tag, ClassControlMetadata).Id
|
||||||
|
Dim recordId As Integer = CURRENT_RECORD_ID
|
||||||
|
|
||||||
|
' Wenn der Filter geleert wurde, Infos über die angehakten Zeilen aus der Datenbank holen
|
||||||
|
If filter.IsEmpty Then
|
||||||
|
Try
|
||||||
|
Dim sql As String = $"SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {controlId} AND RECORD_ID = {recordId}"
|
||||||
|
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||||
|
Dim values As New List(Of Object)
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
values.Add(row.Item(0))
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Verhindern, dass OnSelectionChanged ausgelöst wird
|
||||||
|
IsCancelCheck = True
|
||||||
|
' Jetzt die Werte neu setzen, d.h. die angehakten Zeilen setzen
|
||||||
|
ControlLoader.DataGridViewCheckable.LoadValue(gridView.GridControl, values)
|
||||||
|
IsCancelCheck = False
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add("Error in OnFilterChanged: " & ex.Message)
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Public Sub CheckBoxChanged(sender As Object, ByVal e As EventArgs)
|
Public Sub CheckBoxChanged(sender As Object, ByVal e As EventArgs)
|
||||||
If CURRENT_RECORD_ENABLED = False Then Exit Sub
|
If CURRENT_RECORD_ENABLED = False Then Exit Sub
|
||||||
|
|
||||||
@@ -1047,15 +1082,11 @@ Public Class ClassControlBuilder
|
|||||||
|
|
||||||
AddHandler gridview.SelectionChanged, AddressOf RecordChanged
|
AddHandler gridview.SelectionChanged, AddressOf RecordChanged
|
||||||
AddHandler gridview.SelectionChanged, AddressOf OnCheckedChanged
|
AddHandler gridview.SelectionChanged, AddressOf OnCheckedChanged
|
||||||
AddHandler gridview.CustomDrawColumnHeader, AddressOf OnDrawColumnHeader
|
AddHandler gridview.ColumnFilterChanged, AddressOf OnFilterChanged
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub OnDrawColumnHeader(sender As Object, e As DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs)
|
|
||||||
Console.WriteLine()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
|
|
||||||
Private Sub SetDragDropHandler(groupbox As GroupBox)
|
Private Sub SetDragDropHandler(groupbox As GroupBox)
|
||||||
If Not IsNothing(_group_box_drag_drop_handler) Then
|
If Not IsNothing(_group_box_drag_drop_handler) Then
|
||||||
AddHandler groupbox.DragDrop, Me._group_box_drag_drop_handler
|
AddHandler groupbox.DragDrop, Me._group_box_drag_drop_handler
|
||||||
@@ -1100,7 +1131,7 @@ Public Class ClassControlBuilder
|
|||||||
|
|
||||||
If dialog.ShowDialog() = DialogResult.OK Then
|
If dialog.ShowDialog() = DialogResult.OK Then
|
||||||
pb.BackgroundImageLayout = ImageLayout.Zoom
|
pb.BackgroundImageLayout = ImageLayout.Zoom
|
||||||
pb.BackgroundImage = CType(Drawing.Image.FromFile(dialog.FileName, True), Bitmap)
|
pb.BackgroundImage = CType(System.Drawing.Image.FromFile(dialog.FileName, True), Bitmap)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user