Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
UltraCombo autocomplete filter any column, not just DisplayMember
posted

We have an UltraCombo with multiple columns.  It's currently set to AutoCompleteMode = SuggestAppend.  We'd like to be able to quickly filter the drop-down by any column without having to use the column filter interface that is built into the column header.

For example:

Last    First   Middle
------- ------- ----------
Stevens Robert Tanner
George  Steven Paul
Black   George Robert

 

If the user types "GEO", we'd like it to AutoComplete on the Last name column, but display the last two rows in the dropped-down grid as possible matches (since it also matches on the First name of the last row).

Alternately, we'd like to add an UltraTextEditor above each column (sized the same) when the combo is dropped-down to allow a quick filter on that column.

This will be primarily used in a keyboard-centric environment where a lot of "mousing" is not desired.  Using the column filter interface, while feature-rich, is just unwieldy and over-complicated for our users.

Anyone have an idea on how to accomplish DataSource-wide AutoComplete, not just on the DisplayMember?

Parents
  • 467250
    Offline posted

    Hi,

    There's no way to do this. The current AutoCompleteMode functionality will only search the DisplayMember column.

    Also, the FilterRow is not currently supported for UltraCombo or UltraDropDown. You can turn on the filter icons for the column headers, but this will require a click, so I don' think that is what you want.

    The only way to achieve this that I can see would be to create your own DropDown control. You could do this using UltraTextEditor with a DropDownEditorButton on the ButtonsRight collection that contains a WinGrid. Then you could handle the key event of the UltraTextEditor and do the auto-complete yourself.

    It's not trivial, but it seems like it can be done. Here's a KB article that describes the basic technique of using the UltraTextEditor and the grid with a dropdown button. This article is doing it to get multi-select functionality, which is not what you want, but the basic approach is the same.

    HOWTO:Creating a Multi-Select Dropdown Combo for the WinGrid

  • 380
    Verified Answer
    Offline posted in reply to Mike Saltzman

    Thanks Mike.  We tinkered around with it as much as we could, then came across this:

    http://dandouglas.wordpress.com/2010/03/05/class-to-add-instant-as-you-type-filter-functionality-to-infragistics-ultracombo-control/

    Basically implementing autocomplete by hand over every column.  It's probably inefficient as hell since we have to search through EVERY VISIBLE CELL, but it fulfills the requirement.  Plus, the fields where this functionality will be enabled on are mainly code/description fields, so it shouldn't have a ton of data.

    Here's the meat of our DoPartDropDownFilter (which we named ApplyFilter).  It is embedded in our ComboBox that inherits UltraCombo.  We override OnKeyUp and OnAfterCloseUp to apply/clear the filter:

    foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Rows)
    {
        bool filterRow = true;
        foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in this.DisplayLayout.Bands[0].Columns)
        {
            if (column.IsVisibleInLayout)
            {
                if (row.Cells[column].Text.Contains(this.Text))
                {
                    filterRow = false;
                    break;
                }
            }
        }
        if (filterRow)
        {
            row.Hidden = true;
        }
        else
        {
            row.Hidden = false;
        }
    }
    

    Any better ways of handling this that you can think of?

Reply Children