jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Value-Label

This topic contains 2 replies, has 1 voice, and was last updated by  lineker 12 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Value-Label Posts
  • Value-Label #20546

    lineker
    Participant

    Hi,

    I want to define a combobox including 2 items with value-label couple as follow

    Value Label
    5 Apple
    7 Orange

    When Apple is selected from combobox, I want to get 5.
    How is it implemented?

    Value-Label #20566

    lineker
    Participant

    Hi,

    I read documents but I could find solution.
    Here my code is

    var fruitList = {
    5 : ‘Apple’,
    7 : ‘Orange’
    };

    $(“#fruitcombo”).jqxComboBox({ source: fruitList , width: ‘200px’, height: ’25px’,});

    $(‘#fruitcombo’).bind(‘select’, function (event) {
    var item = $(‘#fruitcombo’).jqxComboBox(‘getSelectedItem’);
    alert(item.label);
    alert(item.value);
    });

    When I select Apple from combobox, I see Apple at alerts for both value and label.
    But I want to see 5 at alert popup as value.
    How can I do it?

    Value-Label #20587

    lineker
    Participant

    Hi,

    I found solution with binding it with json using displayMember, displayValue properties.

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

You must be logged in to reply to this topic.