jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList getItemByValue Issue

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • getItemByValue Issue #12154

    marchip
    Member

    Hi

    i have a drop down list. I add two item.

    var currentSeriesString =”A|B”;

    var source = currentSeriesString.split(‘|’);

    $(“#series”).jqxDropDownList({ source: source, checkboxes: true, width: 200, height: 25, theme: ‘classic’ });

     

    When i Call

    var item = $(“#series”).jqxDropDownList(‘getItemByValue’, “B”);

     

    item is undefined. Why?

    Thanks

    getItemByValue Issue #12156

    Peter Stoev
    Keymaster

    Hi marchip,

    getItemByValue works for items with label and value when the displayMember and valueMember properties are specified. The source in your sample is a simple array and there is no value there.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    getItemByValue Issue #12165

    marchip
    Member

    var source = new Array();
    var arr = currentSeriesString.split(‘|’);
    for (i = 0; i < arr.length; i++) {
    var itm = {};
    itm["name"] = arr[i];
    source.push(itm);
    }

    $("#series").jqxDropDownList({ source: source, displayMember: 'name', valueMember: 'name', checkboxes: true, width: 200, height: 25, theme: 'classic' });

    Not function.

    getItemByValue Issue #12168

    Peter Stoev
    Keymaster

    Hi marchip,

    Below is a working code:

                    var currentSeriesString ="A|B";
    var source = new Array();
    var arr = currentSeriesString.split('|');
    for (i = 0; i < arr.length; i++) {
    var itm = {};
    itm["name"] = arr[i];
    source.push(itm);
    }
    var dataObj = { localdata: source };
    var dataAdapter = new $.jqx.dataAdapter(dataObj);
    $("#series").jqxDropDownList({ source: dataAdapter, displayMember: 'name', valueMember: 'name', width: 200, height: 25, theme: 'classic' });
    var item = $("#series").jqxDropDownList('getItemByValue', 'B');

    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.