jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList jqxDropDownList initial selection with json using selectItem

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 7 years, 7 months ago.

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

  • Weibing
    Participant

    Hello,
    I’m trying to select a specific item in the dropdown on loadcomplete, however, the dropdown populates, but doesn’t initially select anything. Can anyone point me in the right direction. Much appreciated.

    var pltcSessionDropDown = function(){
    var pltcSessions =
    {
    datatype: “json”,
    datafields:
    [
    { name: ‘pltc_session_id’, type: ‘string’ },
    { name: ‘pltc_session_nm’, type: ‘string’ }
    ],
    url: ‘includes/reports.cfc?method=pltcSessions’
    };
    var sessionDataAdapter = new $.jqx.dataAdapter(pltcSessions,
    {
    loadComplete: function () {
    $(“#myDropDown”).jqxDropDownList(‘selectItem’, ‘1709’);
    }
    }
    );

    return sessionDataAdapter
    };

    var dataAdapter = pltcSessionDropDown();

    $(“#myDropDown”).jqxDropDownList({source: dataAdapter, displayMember: “pltc_session_nm”, valueMember: “pltc_session_id”, theme:’bootstrap’});


    Hristo
    Participant

    Hello Weibing,

    Do you receive any error message in the console?
    If you know the exact index of the item you could use selectedIndex property.
    Also, if this does not help you could get all items with var items = $("#jqxDropDownList").jqxDropDownList('getItems'); and with iteration to select desired item with “selectIndex” method.

    Best Regards,
    Hristo Hristov

    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.