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.
Unfortunately, activation email could not send to your email. Please try again.

searching a GroupingGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

17240 Aug 4,2004 06:56 AM Aug 4,2004 02:47 PM Windows Forms 3
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On August 4, 2004 06:56 AM

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

Administrator [Syncfusion]
Replied On August 4, 2004 06:58 AM

it would need a Find Next too.

Administrator [Syncfusion]
Replied On August 4, 2004 08:25 AM

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

Administrator [Syncfusion]
Replied On August 4, 2004 02:47 PM

ok thanks that was helpful. SetCurrent makes it much easier than i thought.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;