lou/multi-select — pull request #88 by brunobg (2013-08-02 21:10:35+00:00)
Title: select_all and deselect_all work only on visible items

When you filter visible items (such as with a search), select_all and deselect_all should work only on visible items. This fix does that and also sets any input to be not larger than the available space.

How to test this: use the quicksearch example and change to:

```
$('.searchable').multiSelect({
selectableHeader: "",
selectionHeader: "",
selectableFooter: "Select all",
selectionFooter: "Remove all",
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();
}
});
$('.searchable').find('.multisearch-selection-all').click(function(e) {
var s = $(this).parents(".ms-container").siblings('select');
s.multiSelect("deselect_all");
e.preventDefault();
});
$('.searchable').find('.multisearch-selectable-all').click(function(e) {
var s = $(this).parents(".ms-container").siblings('select');
s.multiSelect("select_all");
e.preventDefault();
});
```