Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Is there a way to add an empty option to a Combo box?

    1. SmartClient Version: v9.1p_2014-07-23/Pro Deployment (built 2014-07-23)
    2. Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
    3. N/A
    4. N/A
    5. N/A
    6. Code follows

    Is there a way to add an empty option to a Combo box?

    User need:
    From a user point of view, the Select Item and the Combo box are the same with the difference that one can be typed in and the other cannot.
    The Select Item is clearable via an empty option in the drop down but not the Combo box as the empty option is not available.
    This forces the user to clear the combo box by selecting the typed in text and clearing it or backspacing it.
    Having a form that contains these two controls side by side results in an inconsistent user experience.

    What I tried:
    I added the property "allowEmptyValue : true" to the Select Item widget.
    Being a select item, an empty option is now available as per the documentation.

    Now I require the empty option to be available in a Combo Box. Hence I searched for a way of doing this
    and added the 'allowEmptyValue' property to the Combo Box Item in the hope of getting the same behaviour
    but it did not do so nor should it as per the documentation for a Combo Box.

    Unfortunately, I could find nothing in the documentation that would allow the addition of the empty option in a Combo box.
    Note that the Combo box has an optionDataSource specified as all its data comes from the backend.

    I also tried inserting a valueMap with empty properties in the hope that the final result would be a mix of data from the
    backend and the empty properties. The optionDataSource documentation does indicate that the valueMap would override
    mappings if present and (this is conjecture on my part) *possibly* ignore the rest of the unknown mappings.

    #2
    This is not something we support by default - as you observe, the user interface for ComboBoxItem already allows the user to clear the value by clearing the text field.

    In the 10.1 build we do have a new feature which allows the developer to add options to the pick list, including an option to clear the selected record if appropriate - see the 'comboBoxItem.specialValues' attribute for more on this.
    We have no plans to backport this feature to 9.1.
    If this is essential for you, you could possibly get what you're after by customizing the pick list data set to include an explicit empty option.

    Regards
    Isomorphic Software

    Comment


      #3
      Thank you!
      My question is answered.

      Comment


        #4
        Hi Isomorphic,

        this is already in 10.0/5.0, isn't it?

        Best regards
        Blama

        Comment


          #5
          Yes - sorry - we should have been clearer. It is in 10.0 and 10.1

          Comment

          Working...
          X