selectize.js icon indicating copy to clipboard operation
selectize.js copied to clipboard

Can we include only static options through 'options' attribute without any remote loading of data?

Open rajuponnala opened this issue 11 years ago • 3 comments

function createadminUserSuggest(options, selector) { var $commselect = $(selector).selectize({ "onChange": getValue, "valueField": "id", "labelField": "name", "searchField": "name", "create": false, "options": userEmailList, "openOnFocus": false, "closeAfterSelect": true, "render": { option: function(item, escape) { return ( "

" + "" + "" + escape(item.name) + "" + "" + "
" ); } }, }); var adminUserSuggestControl = $commselect[0].selectize; window.communicationSearchBox.adminUserSuggestControl = adminUserSuggestControl; }

function init() {
    $.ajax({
        "url": "/maintain/communication/get-recipient-list",
        "dataType": "json",
        success: function(res) {
            console.log(res.data);
            userEmailList = res.data;
        }
    });
    createadminUserSuggest(userEmailList, "#user_search");
}

This is my code. I don't want any remote data to be loaded as and when user starts typing in the input box. Instead, the 'options' should be provided to the user from the pre-provided options in 'userEmailList'. Does this code work for me. I am not getting the autsuggestions while types. can anyone help with this?

rajuponnala avatar Sep 16 '15 08:09 rajuponnala

Can anyone please revert to me.. I need this urgently by end of the day.. @brianreavis please reply.. Thanks in advance..

rajuponnala avatar Sep 16 '15 08:09 rajuponnala

Asynch programming error: you need to call createadminUserSuggest from within the success function so that it has access to the value of userEmailList.

mcavalletto avatar Jan 22 '16 17:01 mcavalletto

closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.

risadams avatar Nov 12 '20 12:11 risadams