AD
Administrator
Syncfusion Team
August 4, 2004 10:58 AM UTC
it would need a Find Next too.
AD
Administrator
Syncfusion Team
August 4, 2004 12:25 PM UTC
Hi Colin,
if the grouping grid is sorted by that field you are trying to search, the following methods will give you very fast results:
int sp = this.gridGroupingControl1.Table.TopLevelGroup.Records.FindRecord("TEST");
However, since you mention that the table is not sorted by that record this is not a good option.
You do have two options available then:
1) If the underlying table is a searchable/indexed data source try to search the underlying source list index in the
underylying table. You can then convert that underlying source list index into the record index of the grid table.
Example:
int sourceIndex = underlyingDataSource.Find("Test000");
Record r = table.UnsortedRecords[sourceIndex];
r.SetCurrent();
// if you want to know the record index in grid table
int gridIndex = table.Records.IndexOf(r);
2) The slower method which will always works is to loop through the records manually:
int sourceIndex = 0;
FieldDescriptor fd = table.TableDescriptor.Fields["TestField");
foreach (Record r in table.UnsortedRecords)
{
if (fd.GetValue(r) == "Test"))
{
r.SetCurrent();
break;
}
}
We have plans on adding support for searching and more indexing options to the grouping engine in future but we have no timeframe yet when that will happen.
Thanks,
Stefan
AD
Administrator
Syncfusion Team
August 4, 2004 06:47 PM UTC
ok thanks that was helpful. SetCurrent makes it much easier than i thought.