jQuery UI Widgets Forums Lists DropDownList Getting The selected value from a dropdown with image

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 5 months ago.

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

  • dchauhan
    Participant

    I need to get the value that was selected from the dropdown. When I am using the example from the demo, the args.item.label and value are undefined. Please see my code below.

    var splitDropdownSource = [
    {html: “<div style=’height: 60px; float: left;’><span style=’float: left; font-size: 13px; font-family: Verdana Arial;’>2 Column 1 Row</span></div>”, title: ‘2 Column 1 Row’},
    {html: “<div style=’height: 60px; float: left;’><span style=’float: left; font-size: 13px; font-family: Verdana Arial;’>1 Column 2 Row</span></div>”, title: ‘1 Column 2 Row’},
    ];
    $(‘#DashboardDesignerFrameSplitType’).ready(function() {
    $(“#DashboardDesignerFrameSplitType”).jqxDropDownList({
    source: splitDropdownSource,
    selectedIndex: 0,
    width: ‘200’,
    height: ’25px’,
    theme: websiteTheme
    });
    });
    $(‘#DashboardDesignerFrameSplitType’).on(‘select’, function(event) {
    var args = event.args;
    if (args) {
    var index = args.index;
    var item = args.item;
    var originalEvent = args.originalEvent;
    // get item’s label and value.
    var label = item.label;
    var value = item.value;
    alert(“value:”+value+” Label:”+label);
    }
    });


    Peter Stoev
    Keymaster

    Hi dchauhan,

    The label and value are undefined, because your code does not define label and value for each item.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    dchauhan
    Participant

    How do I define them? I used the example for text with icon in the demo? I need to provide text with icon.


    Peter Stoev
    Keymaster

    Hi dchauhan,

    You need to add “label” and “value” members to the objects which you use for initialization.

    Best Regards,
    Peter Stoev

    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.