Search code examples
javascriptjqueryjquery-pluginsmulti-selectjquery-ui-multiselect

eric hynds multiselect filter not showing after destroy and rebind


I am using eric hynds multiselect

Below is the code I am using

data = $.parseJSON(data);
                try {
                    $("#drplist").multiselect('destroy');
                }
                catch (e) {
                }
                $("#drplist").empty();
                $.each(data, function (i, v) {
                    $("#drplist").append("<option>" + v.item + "</option");
                });
               $("#drplist").multiselect({
                    close: function (event, ui) {
                       //do something
                    }
                }).multiselectfilter();

            });

If I do not destroy then multiselect plugin is not working simply showing listbox.

If I destroy then multiselect plugin is working fine, but after rebind it lost filter,

I came across this link https://github.com/ehynds/jquery-ui-multiselect-widget/issues/392

But I need to do destroy.

Please help Thanks


Solution

  • If someone could get help from this..

    I had to destroy the filter explicitly

     $("#drplist").multiselect('destroy');
     $("#drplist").multiselectfilter('destroy');