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

Type ahead

I would like to do a type ahead that would scroll the Grouping grid down to the first match. I know capturer the key strokes and display a dialog showing there current strokes, but how do I programmatically scroll the grid to the best match of the first column?

1 Reply

AD Administrator Syncfusion Team May 28, 2004 11:37 AM UTC

At this time, you can only find the group by looping through the Groups collection in TopLevelGroup and compare the category of each group with your search string. But that is not very efficient, especially since the Groups are already sorted by the category name. Adding support for finding the closest match is not difficult in our source base and we''ll do that for future version. (Sorry - you need to acess internal members therefore our source code needs to be modified). If you have source code and want to check it out add the following lines in Grouping\src\Collections\Groups.cs public Group FindHighestSmallerOrEqualKey(object category) { if (_groupWithGroups != null && _groupWithGroups.ParentGroup != null) { _groupWithGroups.EnsureInitialized(this, true); int c = this._groupWithGroups.ParentTable.GetVisibleCount(); Type type = this._groupWithGroups.columnDescriptors[0].FieldDescriptor.GetPropertyType(); object key = Convert.ChangeType(category, type); GroupsTreeTableEntry gte = (GroupsTreeTableEntry) _inner.TreeTable.FindHighestSmallerOrEqualKey(new object[] { key }); if (gte == null) return null; return gte.Element; } return null; } public Group FindLowestHigherOrEqualKey(object category) { Group g = FindHighestSmallerOrEqualKey(category); if (g.Category.Equals(category)) return g; GroupsTreeTableEntry gte = (GroupsTreeTableEntry) g.GetElementEntry(); ITreeTable tree = gte.Tree; GroupsTreeTableEntry next = tree.GetNextEntry(gte) as GroupsTreeTableEntry; if (next == null) return null; return next.Element; } These functions will now let you find the closest match as follows: Group g = this.groupingGrid1.Table.TopLevelGroup.Groups.FindLowestHigherOrEqualKey("Germa"); Stefan

Live Chat Icon For mobile
Up arrow icon