jQuery UI Widgets Forums Lists DropDownList selectItem/selectIndex not working

This topic contains 10 replies, has 3 voices, and was last updated by  admin 6 years, 8 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • selectItem/selectIndex not working #96148

    ch3s
    Participant

    Hello,
    I have a dropdownlist in custom container, filled in from adapter and item/idex I want to select is obtained by another ajax call.
    Whatever I try to use (selectItem, selectIndex) – it is not working, even if I try simple constant for setting up:
    var selected_client = {
    dataType: ‘json’,
    dataFields: [
    { name: ‘clientId’ },
    { name: ‘firstname’ }
    ],
    id: ‘id’,
    url: ‘${pageContext.request.contextPath}/dpc?c=selectedclients&id=’+editAppointment.id,
    };
    var dataAdapter_selectedClient = new $.jqx.dataAdapter(selected_client,{
    autoBind: true,
    async: false,
    downloadComplete: function () { },
    loadComplete: function () {

    },
    loadError: function () { }
    });
    var selectedClientId = dataAdapter_selectedClient.records[0];

    (the result is always 1 json row).

    var clientContainer = “<div>”;
    clientContainer += “<div class=’jqx-scheduler-edit-dialog-label’>Client</div>”;
    clientContainer += “<div class=’jqx-scheduler-edit-dialog-field’><div id=’client1′></div></div>”;
    clientContainer += “</div>”;
    fields.resourceContainer.prepend(clientContainer);
    $(“#client1”).jqxDropDownList({ autoOpen: true,source: dataAdapter_clients, placeHolder: “Select Client:”,displayMember: “firstname”,
    valueMember: “clientId”});
    $(“#client1”).jqxDropDownList({filterable:true});
    $(“#client1”).jqxDropDownList({incrementalSearch: true});
    $(“#client1”).jqxDropDownList(‘selectItem’, dataAdapter_selectedClient.records[0]);
    even if I just use (‘selectIndex’,2) or ‘2’ or whatever I add here, it is not working?

    Any ideas?

    Kind Regards,
    Vlad

    selectItem/selectIndex not working #96150

    admin
    Keymaster

    Hi ch3s,

    1. selectItem expects a value or listbox item to be passed as argument. selectIndex works well, too.
    2. dataAdapter_clients is undefined in this code.
    3. You can provide a jsfiddle.net sample which demonstrates an issue.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    selectItem/selectIndex not working #96155

    ch3s
    Participant

    Hello,
    sorry I’m new to JavaScript 🙂 here is the jsfiddle:
    https://jsfiddle.net/pLffforb/

    selectItem/selectIndex not working #96160

    ch3s
    Participant

    about 1. …. something like $(“#client1”).jqxDropDownList(‘selectItem’, new jqxListBox({source: dataAdapter_selectedClient}));?

    selectItem/selectIndex not working #96161

    Peter Stoev
    Keymaster

    Hi ch3s,

    1. Unfortunately, the jsfiddle.net does not run. it’s missing references to the used libraries.
    2. The selectItem method expects a different argument type. Please, take a look at online sample: http://jsfiddle.net/jqwidgets/MysU4/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    selectItem/selectIndex not working #96162

    ch3s
    Participant

    Hi Peter,
    I’ve seen it, yet it doesn’t provide enough info, at least for me – what kind of argument is expected (is it value or label, is it object of particular type?).
    In my case there is value – numeric and label – string type.
    I’ve seen all the online examples/demos/forums 🙂
    I will modify the code to be runnable as it is part of dynamic scriptlet.

    Kind Regards,
    Vlad

    selectItem/selectIndex not working #96165

    Peter Stoev
    Keymaster

    Hi ch3s,

    You are passing an Object which is part of your Data source. That is incorrect.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    selectItem/selectIndex not working #96186

    ch3s
    Participant

    Hi Peter,
    that I figured out :), you said I have to pass ListBox…. any pseudo code about this?

    Kind Regards,
    Vlad

    selectItem/selectIndex not working #96189

    Peter Stoev
    Keymaster

    Hi ch3s,

    We have samples about how to use these methods and which arguments they expect. I would suggest you to look at them.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    selectItem/selectIndex not working #96194

    ch3s
    Participant

    Hi Peter,
    as I said before, I’ve seen all the demos/examples/forums, none is close to my case.
    In you main demo you are using string to pass to selectItem and also you have array passed as source (single dimension), my case is List of value-Label .
    Demos are pretty basic though.

    Kind Regards,
    Vlad

    selectItem/selectIndex not working #96219

    admin
    Keymaster

    Hi ch3s,

    But they show what type of arguments are expected.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.