jQWidgets Forums

jQuery UI Widgets Forums Lists ListBox Using null values in source

This topic contains 1 reply, has 2 voices, and was last updated by  ivailo 9 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Using null values in source #71588

    mrwest
    Blocked

    Hello,

    We just discovered that null values in source for a jqxListBox (v.3.8.0) becomes [object Object] when being used.
    This was not the case in earlier versions. At the moment this breaks alot of functionality for us.

    Please advise asap.

    Regards,
    Jan

    Example:

    $(document).ready(function () { 
        var source = [
            {
                "value": null,
                "title": "Has null value",
                "idx": -1
            },
            {
                "value": "value1",
                "title": "Has value",
                "idx": 1
            },
            {
                "value": "value2",
                "title": "Has value 2",
                "idx": 2
            }
        ];
         // Create a jqxListBox
        $("#jqxListBox").jqxListBox({
             source: source,
             width: '200px',
             height: '200px',
             theme:'energyblue',
            valueMember: 'value',
            displayMember: 'title',
             checkboxes:false
         });
        
        $("#jqxListBox").bind('select', function (event) {
            if (event.args) {
                var item = event.args.item;
                if (item) {
                    var valueelement = $("<div></div>");
                    valueelement.html("Value: " + item.value);
                    var labelelement = $("<div></div>");
                    labelelement.html("Label: " + item.label);
                    $("#selectionlog").children().remove();
                    $("#selectionlog").append(labelelement);
                    $("#selectionlog").append(valueelement);
                }
            }
        });
    });
    Using null values in source #71615

    ivailo
    Participant

    Hi mrwest,

    In source variable of the ListBox, you have to use label instead title.
    Look at this fiddle.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.