jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Load data in combobox from some other method

This topic contains 0 replies, has 1 voice, and was last updated by  Shashi Kumar 8 years, 1 month ago.

Viewing 1 post (of 1 total)
  • Author

  • Shashi Kumar
    Participant

    The combobox demo, has url attached while defining the combobox, instead i would like to transfer the control onChange to some other method and load once the response is available.

    i used $(‘#jqxCombobox1’).jqxComboBox({source: data}); but the problem with this is, the searchString typed by user is lost when the data is available.

    var source = {
    datatype: “json”,
    datafields: [
    { name: ‘id’ },
    { name: ‘name’ },
    ],
    async: false
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxCombobox1”).jqxComboBox({
    selectedIndex: 0,
    source: dataAdapter,
    displayMember: ‘name’,
    valueMember: ‘id’,
    minLength:3,
    width: ‘100%’,
    height: 22,
    showArrow: false,
    remoteAutoComplete: true,
    placeHolder : ‘Search Something…’,
    search: function (searchString) {
    callMethod(searchString);
    }
    });

    function callMethod(searchString){
    //do something
    // load data when available and after formatting
    $(‘#jqxCombobox1’).jqxComboBox({source: data});

    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.