jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Unselect

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 13 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Unselect Posts
  • Unselect #3531

    binfch
    Participant

    Hi there

    I have a jqxComboBox. When loading the web page the combobox shows “empty”. Then I can select an item from the list.

    -> How to “reset” the combobox from javascript so that it shown “empty” again?

    Thx & cheers,
    P.

    Unselect #3542

    Peter Stoev
    Keymaster

    You can use the code below to show the ComboBox’s Input as empty:

    $("#jqxWidget").jqxComboBox({ selectedIndex: -1 });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Unselect #3562

    binfch
    Participant

    Hi Peter

    Thanks for your info. Sorry I still am unable to “un”-select. My code looks like:

    var srcCompany = { datatype: "array", localdata: fltCompany };
    var datCompany = new $.jqx.dataAdapter(srcCompany, {uniqueDataFields: ["CompanyId"]});
    $("#cmbImpCompany").jqxComboBox({ source: datCompany, displayMember: "CompanyName", valueMember: "CompanyId", disabled: false });

    the combobox is working and I can select an entry. However…

    $('#cmbImpCompany').jqxComboBox({ selectedIndex: -1 });

    …does not have any effect !? Is there another way to achieve what I need?

    Thx & cheers,
    P.

    Unselect #3563

    binfch
    Participant

    P.S: I can select the first entry in the list using:

    $('#cmbImpCompany').jqxComboBox({ selectedIndex: 0 });

    So I can insert a fake entry (something like “- EMPTY -“), but is still not that nice…

    Thx & cheers,
    P.

    Unselect #3564

    Peter Stoev
    Keymaster

    Hi binfch,

    You can also do this:

    $("#jqxWidget").jqxComboBox('input').val("");

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.