如何从 UltraGrid 的过滤行中获取准确的行索引
How to get accurate row index from filtered rows of an UltraGrid
我有一个 UltraGrid。当我点击一个 Cell 时,我希望它能将 Label 的文本更改为 Record 17 of 2083。这是我的函数:
Private Sub grdBackOrders_ClickCell(sender As Object, e As ClickCellEventArgs) Handles grdBackOrders.ClickCell
Dim rowIndex As Integer = grdBackOrders.ActiveRow.Index + 1
lblCount.Text = "Record " & rowIndex.ToString() & " of " &
CInt(grdBackOrders.DisplayLayout.Rows.VisibleRowCount.ToString()) - 1
End Sub
这在我显示所有 2083 条记录时有效。但是,当我过滤仅显示 30 行的行并单击第 30 条记录时,我的标签显示第 637 条记录,共 30 条记录。我需要它说第 30 条记录,共 30 条记录。
替换
Dim rowIndex As Integer = grdBackOrders.ActiveRow.Index + 1
与
Dim rowIndex As Integer = grdBackOrders.ActiveRow.VisibleIndex
我有一个 UltraGrid。当我点击一个 Cell 时,我希望它能将 Label 的文本更改为 Record 17 of 2083。这是我的函数:
Private Sub grdBackOrders_ClickCell(sender As Object, e As ClickCellEventArgs) Handles grdBackOrders.ClickCell
Dim rowIndex As Integer = grdBackOrders.ActiveRow.Index + 1
lblCount.Text = "Record " & rowIndex.ToString() & " of " &
CInt(grdBackOrders.DisplayLayout.Rows.VisibleRowCount.ToString()) - 1
End Sub
这在我显示所有 2083 条记录时有效。但是,当我过滤仅显示 30 行的行并单击第 30 条记录时,我的标签显示第 637 条记录,共 30 条记录。我需要它说第 30 条记录,共 30 条记录。
替换
Dim rowIndex As Integer = grdBackOrders.ActiveRow.Index + 1
与
Dim rowIndex As Integer = grdBackOrders.ActiveRow.VisibleIndex