We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

searching a GroupingGrid

Hi, I need to implement a search for a grouping grid. it should search all columns for a given string regardless of grouping, then position the display to that record and expand if necessary (even if there are several groups). so i looked at Record r = this.gridGroupingControl1.Table.Records.FindRecord("TEST1001") but it doesn''t compile, says doesn''t contain a definition for FindRecord. this would be nice functionality to add to your examples library ;) thanks in advance Colin

3 Replies

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.

Loader.
Live Chat Icon For mobile
Up arrow icon