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
245
Strange Valuelist/Component-Editor behaviour
posted

Hi,

I recognized a strange behaviour in one of my ultragrids.

When using the combination of one ultracombo as a valuelist and a second one as editorcomponent for one of my columns, all values are displayed correctly. My columns show the "texts" instead of the IDs. So the valuelist is working well.

Clicking one of the columns cells causes a strange behaviour. The cellvalue and so the text switches immediatly to something different. It seems to me, that it changes to the valuelist index instead of using my key to determine the value.

If the editorcomponent would'nt contain my old value, I could understand this, because of the missing relation, but why does it always change?

Here's a piece of code, that explains my thoughts.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim dtGrid As New DataTable
        dtGrid.Columns.Add("Value")
        dtGrid.Rows.Add(1)
        dtGrid.Rows.Add(2)
        dtGrid.Rows.Add(3)
        dtGrid.Rows.Add(4)
        UltraGrid1.DataSource = dtGrid

        Dim dtValues As New DataTable
        dtValues.Columns.Add("Key")
        dtValues.Columns.Add("Text")
        dtValues.Rows.Add(1, "A")
        dtValues.Rows.Add(2, "B")
        dtValues.Rows.Add(3, "C")
        dtValues.Rows.Add(4, "D")
        dtValues.Rows.Add(5, "E")
        dtValues.Rows.Add(6, "F")
        dtValues.Rows.Add(7, "G")
        UltraComboValue.DataSource = dtValues

        Dim dtEdit As New DataTable
        dtEdit.Columns.Add("Key")
        dtEdit.Columns.Add("Text")
        dtEdit.Rows.Add(1, "A")
        dtEdit.Rows.Add(3, "C")
        dtEdit.Rows.Add(5, "E")
        dtEdit.Rows.Add(7, "G")
        UltraComboEdit.DataSource = dtEdit

        UltraComboEdit.ValueMember = "Key"
        UltraComboValue.ValueMember = "Key"
        UltraComboEdit.DisplayMember = "Text"
        UltraComboValue.DisplayMember = "Text"

        SpalteAlsDropDownMitContaisVorschlag(UltraGrid1.DisplayLayout.Bands(0).Columns(0), UltraComboEdit, UltraComboValue)
    End Sub

    Public Shared Sub SpalteAlsDropDownMitContaisVorschlag(ByVal Spalte As UltraGridColumn, _
                                                          ByVal EditCombo As UltraCombo, _
                                                          ByVal ValueListe As UltraCombo)
        With Spalte
            With EditCombo
                .DropDownStyle = UltraComboStyle.DropDown
                .AutoCompleteMode = AutoCompleteMode.SuggestAppend
                .AutoSuggestFilterMode = AutoSuggestFilterMode.Contains
            End With

            .EditorComponent = EditCombo
            .ValueList = ValueListe

            .AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
            .AutoSuggestFilterMode = AutoSuggestFilterMode.Contains
            .Style = ColumnStyle.DropDownValidate
            .InvalidValueBehavior = InvalidValueBehavior.RetainValueAndFocus

        End With
    End Sub


End Class

 

I hope you can help me understanding what happens here and how I can get the correct values when clicking a cell.

Thanks in advance

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    It does not make sense to set the EditorComponent on a column to one UltraCombo and the ValueList to a different UltraCombo.

    Perhaps if you explain what you are trying to achieve here, I might be able to suggest a better way to do it.

    Having said that, the behavior you are getting here is a bit odd. I think this is probably happening because of an optimization where the grid caches the index of the selected item on the list. When it goes into edit mode, the editor is picking up the item at that index instead of the item that matches the value.

    This may be a bug in the grid, but since I would be very hesitant to change any of this behavior in the grid, since what you are doing here is rather bizarre and there's a good chance that "fixing" this might cause other issues.

Children