this.sfDataGrid1.SearchController.Search(this.textBox1.Text);
int matchCount = 0;
foreach (var item in this.sfDataGrid1.View.Records)
{
if (!item.IsRecords)
continue;
var data = (item as RecordEntry).Data;
foreach (var column in this.sfDataGrid1.Columns)
{
var cellValue = this.sfDataGrid1.View.GetPropertyAccessProvider().GetFormattedValue(data, column.MappingName).ToString();
List<int> matchList = Regex.Matches(cellValue, this.sfDataGrid1.SearchController.SearchText, this.sfDataGrid1.SearchController.AllowCaseSensitiveSearch ? RegexOptions.None : RegexOptions.IgnoreCase)
.Cast<Match>()
.Select(s => s.Index).ToList();
if (matchList.Count > 0)
matchCount++;
}
}
label1.Text = "Match Count = " + matchCount; |
I got what I wanted with your help.
Thank you.
But the more data in sfdatagrid, the slower your code.
On the other hand, the search function of sfdatagrid is processed immediately.
So in the end I can't use your code.
Do you have any plans to put count in sfdatagrid's SearchController?
Yes.
Your advice has helped me a lot.
Thank you.
Regards,
Ki Hun.