This code sample shows how to organize text search in FlyGrid:
[VB.Net]
Public Class SearchData
Public FoundCol As Integer
Public FoundNode As NodeBase
Public ReadOnly SearchText As String
Public Sub New(ByVal searchString As String)
Me.SearchText = searchString
End Sub
End Class
Private Function Find(ByVal nodes As NodeCollection, ByVal data As SearchData) As Boolean
If (Not nodes Is Nothing) Then
For Each child As NodeBase In nodes
Dim val As Object() = child.Value
If (Not val Is Nothing) Then
For i As Integer = 0 To val.Length - 1
Dim cellValue As String = val.GetValue(i)
If (Not cellValue Is Nothing And cellValue.Equals(data.SearchText)) Then
data.FoundNode = child
data.FoundCol = i
Return True
End If
Next
End If
If (child.HasChildren) Then
If Find(child.Items, data) Then
Return True
End If
End If
Next
End If
Return False
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim data As SearchData = New SearchData("Nested4")
If (Find(flyGrid.Rows.Items, data)) Then
flyGrid.Selected = data.FoundNode
End If
End Sub