@@ -31,12 +31,12 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
3131 var template = '<div class="multiselect-parent btn-group dropdown-multiselect">' ;
3232 template += '<button type="button" class="dropdown-toggle" ng-class="settings.buttonClasses" ng-click="toggleDropdown()">{{getButtonText()}} <span class="caret"></span></button>' ;
3333 template += '<ul class="dropdown-menu dropdown-menu-form" ng-if="open" ng-style="{display: open ? \'block\' : \'none\', height : settings.scrollable ? settings.scrollableHeight : \'auto\' }" style="overflow: auto" >' ;
34- template += '<li ng-if="settings.showCheckAll && settings.selectionLimit > 0 "><a ng-keydown="keyDownLink($event)" data-ng-click="selectAll()" tabindex="-1" id="selectAll"><span class="glyphicon glyphicon-ok"></span> {{texts.checkAll}}</a>' ;
34+ template += '<li ng-if="settings.showCheckAll && settings.selectionLimit !== 1 "><a ng-keydown="keyDownLink($event)" data-ng-click="selectAll()" tabindex="-1" id="selectAll"><span class="glyphicon glyphicon-ok"></span> {{texts.checkAll}}</a>' ;
3535 template += '<li ng-if="settings.showUncheckAll"><a ng-keydown="keyDownLink($event)" data-ng-click="deselectAll();" tabindex="-1" id="deselectAll"><span class="glyphicon glyphicon-remove"></span> {{texts.uncheckAll}}</a></li>' ;
3636 template += '<li ng-if="settings.showEnableSearchButton && settings.enableSearch"><a ng-keydown="keyDownLink($event); keyDownToggleSearch();" ng-click="toggleSearch($event);" tabindex="-1">{{texts.disableSearch}}</a></li>' ;
3737 template += '<li ng-if="settings.showEnableSearchButton && !settings.enableSearch"><a ng-keydown="keyDownLink($event); keyDownToggleSearch();" ng-click="toggleSearch($event);" tabindex="-1">{{texts.enableSearch}}</a></li>' ;
3838 template += '<li ng-if="(settings.showCheckAll && settings.selectionLimit > 0) || settings.showUncheckAll || settings.showEnableSearchButton" class="divider"></li>' ;
39- template += '<li ng-if="settings.enableSearch"><div class="dropdown-header"><input type="text" class="form-control searchField" ng-keydown="keyDownSearchDefault($event); keyDownSearchSingle ($event, input.searchFilter);" style="width: 100%;" ng-model="input.searchFilter" placeholder="{{texts.searchPlaceholder}}" /></li>' ;
39+ template += '<li ng-if="settings.enableSearch"><div class="dropdown-header"><input type="text" class="form-control searchField" ng-keydown="keyDownSearchDefault($event); keyDownSearch ($event, input.searchFilter);" style="width: 100%;" ng-model="input.searchFilter" placeholder="{{texts.searchPlaceholder}}" /></li>' ;
4040 template += '<li ng-if="settings.enableSearch" class="divider"></li>' ;
4141
4242 if ( groups ) {
@@ -266,11 +266,13 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
266266 return '' ;
267267 } ;
268268
269- $scope . selectAll = function ( ) {
269+ $scope . selectAll = function ( ) {
270+ var searchResult ;
270271 $scope . deselectAll ( false ) ;
271272 $scope . externalEvents . onSelectAll ( ) ;
272273
273- angular . forEach ( $scope . options , function ( value ) {
274+ searchResult = $filter ( 'filter' ) ( $scope . options , $scope . getFilter ( $scope . input . searchFilter ) ) ;
275+ angular . forEach ( searchResult , function ( value ) {
274276 $scope . setSelectedItem ( value [ $scope . settings . idProp ] , true ) ;
275277 } ) ;
276278 } ;
@@ -419,19 +421,21 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
419421 }
420422 } ;
421423
422- $scope . keyDownSearchSingle = function ( event , searchFilter ) {
424+ $scope . keyDownSearch = function ( event , searchFilter ) {
423425 var searchResult ;
424- if ( ! $scope . settings . keyboardControls ) {
425- return ;
426- }
427- if ( $scope . settings . selectionLimit === 1 && $scope . settings . enableSearch ) {
428- if ( event . keyCode === 13 ) {
429- searchResult = $filter ( 'filter' ) ( $scope . options , $scope . getFilter ( searchFilter ) ) ;
430- if ( searchResult . length === 1 ) {
431- $scope . setSelectedItem ( $scope . getPropertyForObject ( searchResult [ 0 ] , $scope . settings . idProp ) ) ;
432- }
433- }
434- }
426+ if ( ! $scope . settings . keyboardControls ) {
427+ return ;
428+ }
429+ if ( event . keyCode === 13 ) {
430+ if ( $scope . settings . selectionLimit === 1 && $scope . settings . enableSearch ) {
431+ searchResult = $filter ( 'filter' ) ( $scope . options , $scope . getFilter ( searchFilter ) ) ;
432+ if ( searchResult . length === 1 ) {
433+ $scope . setSelectedItem ( $scope . getPropertyForObject ( searchResult [ 0 ] , $scope . settings . idProp ) ) ;
434+ }
435+ } else if ( $scope . settings . enableSearch ) {
436+ $scope . selectAll ( ) ;
437+ }
438+ }
435439 } ;
436440
437441 $scope . getFilter = function ( searchFilter ) {
0 commit comments