Hi!
I'm using an ultraComboEditor as EditorCompent for a WinGrid column in the IntializeLayout event.
DataSource is a .NET DataSet, AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append
AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.StartsWith
ultraComboEditor1.DropDownStyle = Infragistics.Win.DropDownStyle.DropDown
I use the ValueMember property, not the DisplayMember property.
This column in the DataSet has at the beginning only a few values, most of them are empty strings ("").
Behavior:
The list contains for every empty string a particular item.
The list will be updated with every new string, even it's allways the same. E.g. editing the cells with "Tom" for 3 times, results in 3 "Tom"-strings (items) in the list.
AutoComplete only works correctly after a second - and different from the first - string was inserted. That means for example that the AutoComplete-function for "Tom" not works till "Eve" is also in the list. After that AutoComplete works for both strings correctly. But not if only one new string is in the list.
And now my questions:
First of all: Is there any other simple way to implement a real Excel-style AutoComplete? Im using Version 12.1
Why are all empty strings in the list and why are the same (new) strings repeatedly in the list? Is there a possibility to avoid duplicates?
What's the reason of the funny manner described above of the not really correct working AutoComplete?
Thank you very much and kind regards.
Tom
Tracking the changes will be fairly simple. You just have to trap events on the grid like AfterCellUpdate, AfterRowsDeleted, and AfterRowUpdate (to detect newly-added rows).
Building the unique list is a bit trickier. If you are using CLR4, then I would use a HashSet<string>. That way you don't have to worry about duplicate values and you can efficiently keep a unique list without having to loop through the items to find duplicates.
Then you take your HashSet and convert it to a List or array and bind it to the dropdown you are using in the column.
Hi Mike,
sorry for the torture :-(
You're right, unique items would be best. Ok I understand the list is simply a collection of all items from the DataSource and I have to manage them for myself.
Now I'll have a hard time...
Kind regards
Hi Tom,
I'm having a hard time following you.
It sounds like what you mean by "Excel-Style" autocomplete is that the list contains a unique list of items that exist in the cells of the column.
There is no built-in way to do that with the WinGrid. You have to populate the list yourself. So if there are duplicates or empty strings on your dropdown list, it's because the list you are providing (either by adding items to the UltraComboEditor directly, or in the DataSource of the UltraComboEditor) contains those empty and duplicate items.
To make this work like Excel, you would have to handle populating the list and keeping the items unique. This is no small task, since you have to deal with any time an item in the grid is changed, added, or deleted.