Hello,
I am using virtual mode and have turned on column moving.
When columns are moved, they end up with the wrong data. They are getting another column's data - not their own.
I am retrieving/setting data solely by column name (not index). So the fact that the column index has changed should be irrelevant.
I am including the source I am using:
[VB.Net]
Imports NineRays.Windows.Forms
Imports NineRays.Windows
Imports NineRays.Windows.Forms.Data
Imports NineRays.Windows.Forms.Grids
Public Class Form1
Dim dataCtl As New DataTable
Private Function grid_VirtualMode_GetCount(ByVal sender As NineRays.Windows.Forms.Data.NodeBase) As Integer Handles grid.VirtualMode_GetCount
Return dataCtl.Rows.Count
End Function
Private Function grid_VirtualMode_GetNodeCellValue(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase, ByVal index As Integer) As Object Handles grid.VirtualMode_GetNodeCellValue
Return dataCtl.Rows(node.Index)(grid.Columns.Items(index).FieldName)
End Function
Private Function grid_VirtualMode_HasChildren(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase) As Boolean Handles grid.VirtualMode_HasChildren
Return False
End Function
Private Function grid_VirtualMode_InitNewNode(ByVal sender As Object, ByVal parent As NineRays.Windows.Forms.Data.NodeBase, ByVal index As Integer) As NineRays.Windows.Forms.Data.NodeBase Handles grid.VirtualMode_InitNewNode
Return New TestNode(parent)
End Function
Private Sub grid_VirtualMode_SetNodeCellValue(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase, ByVal index As Integer, ByVal value As Object) Handles grid.VirtualMode_SetNodeCellValue
dataCtl.Rows(node.Index)(grid.Columns.Items(index).FieldName) = value
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dataCtl.Columns.Add(\"Col1\")
dataCtl.Columns.Add(\"Col2\")
dataCtl.Columns.Add(\"Col3\")
For i As Integer = 1 To 10
dataCtl.Rows.Add(New Object() {\"Col1Value\", \"Col2Value\", \"Col3Value\"})
Next
grid.Columns.Items.Add(New Column(\"Col1\"))
grid.Columns.Items.Add(New Column(\"Col2\"))
grid.Columns.Items.Add(New Column(\"Col3\"))
grid.Rows.Options = RowsOptions.ShowIndicators Or RowsOptions.ShowRowHeaders
grid.Columns.Options = ColumnsOptions.Moveable Or ColumnsOptions.ShowHeaders Or ColumnsOptions.Sizable Or ColumnsOptions.Clickable
grid.Rows.VirtualMode = True
End Sub
End Class
Public Class TestNode
Inherits VirtualNode
'Property variables...
Public Sub New(ByVal parent As NodeBase)
MyBase.New(parent)
End Sub
End Class