jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList DropDownList is now setting value to display member if valueMember value is null

This topic contains 4 replies, has 2 voices, and was last updated by  Marc 12 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • Marc
    Participant

    In the new 2.5 release, if displayMember and valueMember are used and an item has a valueMember which is null or the null string then the displayMember value is returned as the selected item’s value. Previously (at least as of 2.4.1), the null value would be returned as a value.

    For example:

    src: [{label: "(select one)", value: ""},...],
    displayMember:'label',
    valueMember: 'value',
    ...

    This will result in the selected item having a value of ‘(select one)’.

    As illustrated in this example, having a null value can be useful for the case in which the user has not made a valid selection from the list.


    Peter Stoev
    Keymaster

    Hi Marc,

    When there’s no selection, a prompt text is displayed. That prompt text is specified by the promptText property.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Marc
    Participant

    Thanks Peter, promptText does seem to do the trick for the DropDownList. It is slightly different than having the prompt in a selectable item in that the user cannot get back to the unselected state, but I don’t see that being an issue.

    However, the same issue arises with the ComboBox widget. I have configured a combo box with checkboxes such that selecting the first checkbox clears all the other checkbox selections in the list (representing a nothing selected state). Thus, I would like the associated value for that checkbox item to be the null string that I am setting it to in the configuration, which it was in 2.4.1 but in 2.5 it is now the displayMember value.


    Peter Stoev
    Keymaster

    Hi Marc,

    Thanks for the feedback!

    I am sorry that the new behavior of the widget does not fit to your expectations and custom logic, but that’s how the widget works in the new version. I will log your feedback in our TO DO list and we will consider making changes in the upcoming releases. Btw. ComboBox with Checkboxes was not supported in 2.4.1. This is a new feature.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Marc
    Participant

    Peter – thanks for the quick responses!

    I was incorrect – it was a DropDownList with checkboxes, not a ComboBox.

    I hope they will minimally document this behavior as there is nothing currently in the documentation to indicate that the value of the valueMember will not be returned when that value is the null string (that the value of the displayMember will be returned instead).

    I can work around this in my particular situation – I wanted to provide an example though to illustrate that there are situations in which it is desirable to use an empty string as the value. Please include as part of my feedback the suggestion that they allow null strings to be used as values and only default to the displayMember when the value is actually null. Do you know what the rationale was for the change?

    Marc

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.