multi-select icon indicating copy to clipboard operation
multi-select copied to clipboard

multiselect with quicksearch plugin, must click item once and then can work well

Open jamesduan opened this issue 8 years ago • 2 comments

     selectableHeader: "<input type='text' id='search_input' class='search-input form-control' autocomplete='on' placeholder='search'>",
      afterSelect: function(values) {
          selected_hosts.push(values[0]);
          this.qs1.cache();
      },
      afterDeselect: function(values) {
          selected_hosts.remove(values[0]);
          this.qs1.cache();
      },
      afterInit: function(ms) {
        init_hosts();
        var that = this,
          $selectableSearch = that.$selectableUl.prev(),
          selectableSearchString = '#'+that.$container.attr('id')+' .ms-elem-selectable:not(.ms-selected)';
          that.qs1 = $selectableSearch.quicksearch(selectableSearchString).on('keydown', function(e){
                if(e.which === 40){
                    that.$selectableUl.focus();
                    return false;
                }
          });

      }

$('#xxx').multiSelect(), option parameter is these but i must click the item once and then the search function can work well .

jamesduan avatar Jul 12 '16 03:07 jamesduan

I met the same problem, I found that the reason is that we init the multi-select plugin first and then using 'addOption' to add the options. But I am still thinking of how to fix this.

MUYUSY avatar Sep 14 '17 07:09 MUYUSY

I got the solution, after "addOption", use $('#xxx').multiSelect('refresh') can fix this problem.

MUYUSY avatar Sep 14 '17 07:09 MUYUSY