jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList Bug when displayMember == 'value'

This topic contains 3 replies, has 2 voices, and was last updated by  ivailo 9 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Bug when displayMember == 'value' #73816

    cblin
    Participant
    //the following is working
        var source = [{ "key": 1, "text": "Purple" }, { "key": 2, "text": "Red" }, { "key": 3, "text": "Blue" }];
        var t1 = $('<div/>').appendTo('body');
        t1.jqxDropDownList({ source: source, valueMember: 'key', displayMember: 'text' });
        if (typeof t1.jqxDropDownList('getItemByValue', 1) == 'undefined') {
            alert('bug in jqWidget'); //does not happen
        }
    
        //while this is NOT working (the only change is that displayMember=='value' instead of 'text')
        var source = [{ "key": 1, "value": "Purple" }, { "key": 2, "value": "Red" }, { "key": 3, "value": "Blue" }];
        var t2 = $('<div/>').appendTo('body');
        t2.jqxDropDownList({ source: source, valueMember: 'key', displayMember: 'value' });
        if (typeof t2.jqxDropDownList('getItemByValue', 1) == 'undefined') {
            alert('bug in jqWidget'); //happen
        }

    there is an “easy but ugly workaround” that I’d like to remove as soon as possible 🙂 :
    source = source.map(function(e) { return { key: e.key, text: e.value } });

    Bug when displayMember == 'value' #73871

    ivailo
    Participant

    Hi cblin,

    Try do not use value cause it’s a reserved keyword and its usage generates problems.
    Change your source properties names from value to whatever else and the problem must be solved.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Bug when displayMember == 'value' #73888

    cblin
    Participant

    value is not a reserved keyword in javascript and I do not see why jqWidget would add such a thing !
    I mean, soon I will not be able to use ‘uid’ because this is also a reserved keyword ?

    Of course I can change the source property name because this is what I use in the easy but ugly workaround.
    What I ask for is that jqwidget allow me to use displayMember:’value’ or at least the documentation should say that you can not (this is also an easy but ugly workaround to me but I can understand that :)).

    Bug when displayMember == 'value' #73941

    ivailo
    Participant

    Hi cblin,

    Thanks for the comment.
    At this time the only way you can use is this easy workaround.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.