Reputation: 870
I have an UltraCombo set inside an UltraGrid, with AutoComplete set to "Suggest". The UltraCombo has a DisplayMember of "Name" and a ValueMember of "ID". What I've found is that when I attach a DataFilter to the UltraCombo (I'd like to make it appear blank when the value is zero), if they type a digit that happens to match an ID and also starts a Name, it will do the autocomplete, but the underlying value is never changed. So no AfterUpdate or CellChange is triggered, and when you leave the cell, it reverts to blank. How can I have AutoComplete work and still show the zero-value as blank? Here's my code (Note, if you comment out the line where UltraCombo1.DataFilter is set, updates work fine, but you lose the DataFiltering):
Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win
Public Class Form1
Public Sub New()
InitializeComponent()
Dim datatableCombo = New DataTable
datatableCombo.Columns.Add("ID", GetType(Integer))
datatableCombo.Columns.Add("Name", GetType(String))
datatableCombo.Rows.Add({1, "123"})
datatableCombo.Rows.Add({2, "234"})
datatableCombo.Rows.Add({3, "456"})
UltraCombo1.DataFilter = New MyDataFilter()
UltraCombo1.DataSource = datatableCombo
UltraCombo1.ValueMember = "ID"
UltraCombo1.DisplayMember = "Name"
Dim position As Integer = 0
UltraCombo1.DisplayLayout.Bands(0).Columns("ID").Hidden = False
UltraCombo1.DisplayLayout.Bands(0).Columns("ID").Header.VisiblePosition = position
position += 1
UltraCombo1.DisplayLayout.Bands(0).Columns("Name").Hidden = False
UltraCombo1.DisplayLayout.Bands(0).Columns("Name").Header.VisiblePosition = position
position += 1
Dim datatableGrid = New DataTable
datatableGrid.Columns.Add("ID", GetType(Integer))
datatableGrid.Columns.Add("Name", GetType(String))
UltraGrid1.DataSource = datatableGrid
UltraGrid1.DisplayLayout.GroupByBox.Hidden = True
UltraGrid1.DisplayLayout.Override.RowSelectors = DefaultableBoolean.True
UltraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom
UltraGrid1.DisplayLayout.Bands(0).Columns("ID").EditorComponent = UltraCombo1
UltraGrid1.DisplayLayout.Bands(0).Columns("ID").CellClickAction = CellClickAction.EditAndSelectText
UltraGrid1.DisplayLayout.Bands(0).Columns("ID").Style = ColumnStyle.DropDownValidate
End Sub
Public Class MyDataFilter
Implements Infragistics.Win.IEditorDataFilter
Public Function Convert(ByVal convertArgs As Infragistics.Win.EditorDataFilterConvertArgs) As Object Implements Infragistics.Win.IEditorDataFilter.Convert
' Shouldn't affect anything?
convertArgs.Handled = False
Return Nothing
End Function
End Class
End Class
Upvotes: 1
Views: 899
Reputation: 870
Turns out this was a bug in Infragistics 11.2. I'm not sure at what point they fixed it, but it doesn't happen with version 15.2.
Upvotes: 0
Reputation: 2120
You need to set AutoCompleteMode to the grid column and not to the Ultracombo. When UltraCombo is set as EditorComponent the grid uses its editor. If you set AutoCompleteMode to the combo in this situation it does not have any effect in the grid. If you set AutoCompleteMode to the grid's column you will not need also to set DataFilter to the combo.
Upvotes: 1