malihu-custom-scrollbar-plugin icon indicating copy to clipboard operation
malihu-custom-scrollbar-plugin copied to clipboard

Scrollbar not updating with Select2 autocomplete

Open saravanaams opened this issue 6 years ago • 2 comments

Hi, I'm using the malihu scrollbar in select2 autocomplete. It's working.But when i type something in autosomplete the scrollbar changes to its default style. I'm using Aurelia JS. Could you please help to fix this. import { customAttribute, inject } from 'aurelia-framework'; import $2 from 'jquery2'; import $3 from 'jquery3';

@customAttribute('select2-searchbox') @inject(Element) export class Select2SearchboxCustomAttribute { constructor(element) { this.element = element; }

attached() {
    $2(this.element).select2({
            minimumInputLength: 0,
            placeholder: function() {
                $2(this).data('placeholder');
            }
        })
        .on('change', (e) => {
            if (!e.originalEvent) {
                this.element.dispatchEvent(
                    new CustomEvent('change', { bubbles: true })
                );
            }
        }).on('select2:open', function(e) {
            $3('.select2-results__options').mCustomScrollbar('destroy');
            setTimeout(function() {
                $3('.select2-results__options').mCustomScrollbar();
            }, 0);
        });
}

detached() {
    $2(this.element).select2('destroy');
}

}

saravanaams avatar Mar 26 '18 05:03 saravanaams

I have the same issue but without any frameworks

viktorkyssa avatar Jun 28 '19 06:06 viktorkyssa

I am having the same issue, already spent enough time searching for solution, I found another library nicescroll and it is working fine with select 2.

amanpoptin avatar Jul 25 '19 10:07 amanpoptin