jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList Can't set {displayMember: 'value', valueMember: 'key'}

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

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

  • vul3q04
    Participant

    I set jqxDropDownList like this:

    
        $('#field_type').jqxDropDownList({
            source: $.jqx.dataAdapter({
            url: serviceUrl,
            datafields: [{name: 'key'}, {name: 'value'}],}),
            displayMember: 'value', valueMember: 'key',
        });
    
    

    When I selected a item, then $('#field_type').val() get the text.
    I set valueMember is ‘Key’ but is return ‘value'(the displayMember).
    I need the key column.


    admin
    Keymaster

    Hi vul3q04,

    You can use getSelectedItem method of jqxDropDownList

    Gets the selected item. The returned value is an Object or null(if there is no selected item).

    Item Fields
    label – gets item’s label.
    value – gets the item’s value.
    disabled – gets whether the item is enabled/disabled.
    checked – gets whether the item is checked/unchecked.
    hasThreeStates – determines whether the item’s checkbox supports three states.
    html – gets the item’s display html. This can be used instead of label.
    index – gets the item’s index.
    group – gets the item’s group.
    Parameter Type
    None Return Value
    Object
    Code example
    Invoke the getSelectedItem method.

    // @param Number
    var item = $(“#jqxDropDownList”).jqxDropDownList(‘getSelectedItem’);

    Regards,
    Peter

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

You must be logged in to reply to this topic.