Combobox filtering

Posted by: dijon on 8 September 2017, 1:57 pm EST

  • Posted 8 September 2017, 1:57 pm EST

    Hi,

     Is there anyway of changing what is displayed in the filter dropdown when filtering is enabled on a column. ie to show either the ValueMember or the DisplayMember of the combobox.

    Thanks 

  • Replied 8 September 2017, 1:57 pm EST

     


    Hello,


    Autofilter includes the cell value in the Filter Item list, if there is a value in ComboBox cell it should show up in the Filter List. The following code snippet illustrates the same, please have a look.


    Dim cbstr As String()


    cbstr = New String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}


    Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()


    cmbocell.Items = cbstr


    FpSpread1.ActiveSheet.Columns(0).CellType = cmbocell


    FpSpread1.ActiveSheet.Columns(0).AllowAutoFilter = True


     


     


     Hope it will help you.


     Regards,


     

  • Replied 8 September 2017, 1:57 pm EST

    Hi,

    thanks for reply.

    My problem is that I have a combo box with is loaded with the combo.listcontrol = new listbox (which contains) objects. So what I think is happening it is displaying the .ToString property of the object but when I try to filter is uses and displays the id value.

    So if there a way to tell the combo.ListControl what to display when filtering.

     

    Thanks

  • Replied 8 September 2017, 1:57 pm EST

    Hello,

    I am not sure if you are referring to Items and ItemData properties of the ComboBox cell type. If this is the case, then you can definitley set different values for Combobox Items and ItemData as follows:

            Dim cmboCell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
            Dim sItem As String()
            Dim sItemData As String()
            sItem = New String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}
            sItemData = New String() {"1", "2", "3", "4", "5", "6"}
            cmboCell.Items = sItem
            cmboCell.ItemData = sItemData
            cmboCell.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData
            FpSpread1.ActiveSheet.Columns(0).CellType = cmboCell

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels