tagify icon indicating copy to clipboard operation
tagify copied to clipboard

dropdown tagify.on('dropdown:select', onSelectSuggestion) not working

Open jachanaka opened this issue 4 years ago • 1 comments

dropdown tagify.on('dropdown:select', onSelectSuggestion) not working right after binding whitelist

if I add timeout its working, is there any settings to handle that other than timeout ?

setTimeout(function () { tagify.loading(false).dropdown.show(value); }, 100); // render the suggestions dropdown
function onSelectSuggestion(e) {

        // HERE IS THE PROBLEM
        $($('#users-list').children().first()[0]).attr('disabled', 'disabled');

}

function onInput(e) {

        var value  = e.detail.value;
        var option = $('input[name="radOption"]:checked').val();

        if (value.length < 3) {
            return;
        }

        // show loading animation and hide the suggestions dropdown
        tagify.loading(true).dropdown.hide();

        tagify.settings.whitelist = [];

        $.ajax({
            url: '/Common/GetEmployeesBySearchKey/',
            type: 'GET',
            data: { searchKey: value, option: option  },
            contentType: 'application/json',
            success: function (d) {

                var data = d.data;

                var whitelist = [];
                for (let i = 0; i < data.length; i++) {
                    var obj = {
                        value: data[i].UserID,
                        name: data[i].FirstName + ' ' + data[i].LastName,
                        email: data[i].UserEmail,
                        payid: data[i].PayRollID,
                        avatar: data[i].ProfileImagePath == '' ? '~/images/ProfileImages/43876' : data[i].ProfileImagePath,
                    }
                    whitelist.push(obj);
                }

                tagify.settings.whitelist = whitelist;
                tagify.loading(false).dropdown.show(value); // added timeout here


            },
            error: function (err, type, httpStatus) {

            }

        });
    }

jachanaka avatar Oct 25 '21 01:10 jachanaka

Please create a jsbin example as explained in the issue template (which you deleted) so I could inspect your code and not spend time creating an example jsbin myself, as I am flooded with work.... sorry :)

yairEO avatar Oct 25 '21 16:10 yairEO