When you use the search feature
, and then use the select_all
it does not work together, it selects "everything" as if the search made no change, but the search itself "hides" the elements. It should only select all to the items that are visible
Wondering if someone else has had this issue or knows a solution to it. Thanks again if anyone can be of assistance!
Using the jQuery MultiSelect Plugin: http://loudev.com
This is the code I'm currently using, the search utilizes the quicksearch
js
$('.multiSelect').multiSelect({
selectableHeader: "<div><a href='#' id='select-all'>select all</a></div><input type='text' class='search-input form-control' autocomplete='off' placeholder='search' style='margin-bottom:5px'>",
selectionHeader: "<div><a href='#' id='deselect-all'>deselect all</a></div><input type='text' class='search-input form-control' autocomplete='off' placeholder='search' style='margin-bottom:5px'>",
afterInit: function(ms){
var that = this,
$selectableSearch = that.$selectableUl.prev(),
$selectionSearch = that.$selectionUl.prev(),
selectableSearchString = '#'+that.$container.attr('id')+' .ms-elem-selectable:not(.ms-selected)',
selectionSearchString = '#'+that.$container.attr('id')+' .ms-elem-selection.ms-selected';
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
.on('keydown', function(e){
if (e.which === 40){
that.$selectableUl.focus();
return false;
}
});
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
.on('keydown', function(e){
if (e.which == 40){
that.$selectionUl.focus();
return false;
}
});
},
afterSelect: function(){
this.qs1.cache();
this.qs2.cache();
},
afterDeselect: function(){
this.qs1.cache();
this.qs2.cache();
}
});
$('#select-all').on('click',function(){
$('.multiSelect').multiSelect('select_all');
return false;
});
$('#deselect-all').on('click',function(){
$('.multiSelect').multiSelect('deselect_all');
return false;
});
jsfiddle for demonstration: http://jsfiddle.net/b8ygzqca/6/