@@ -23,7 +23,7 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
2323 searchFilter : '=?' ,
2424 translationTexts : '=' ,
2525 groupBy : '@' ,
26- groups : '='
26+ currentGroups : '=selectByGroups '
2727 } ,
2828 template : function ( element , attrs ) {
2929 var checkboxes = attrs . checkboxes ? true : false ;
@@ -34,11 +34,11 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
3434 template += '<ul class="dropdown-menu dropdown-menu-form" ng-if="open" ng-style="{display: open ? \'block\' : \'none\', height : settings.scrollable ? settings.scrollableHeight : \'auto\', overflow: \'auto\' }" >' ;
3535 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>' ;
3636 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>' ;
37- template += '<li ng-if="currentGroups" class="divider"></li>' ;
37+ template += '<li ng-if="currentGroups && ((settings.showCheckAll && settings.selectionLimit > 0) || settings.showUncheckAll) " class="divider"></li>' ;
3838 template += '<li ng-repeat="currentGroup in currentGroups track by $index"><a ng-bind="::currentGroup.title" ng-click="selectCurrentGroup(currentGroup)" ng-class="{\'dropdown-selected-group\': selectedGroup == currentGroup.value}" tabindex="-1"></a></li>' ;
3939 template += '<li ng-if="settings.showEnableSearchButton && settings.enableSearch"><a ng-keydown="keyDownLink($event); keyDownToggleSearch();" ng-click="toggleSearch($event);" tabindex="-1">{{texts.disableSearch}}</a></li>' ;
4040 template += '<li ng-if="settings.showEnableSearchButton && !settings.enableSearch"><a ng-keydown="keyDownLink($event); keyDownToggleSearch();" ng-click="toggleSearch($event);" tabindex="-1">{{texts.enableSearch}}</a></li>' ;
41- template += '<li ng-if="(settings.showCheckAll && settings.selectionLimit > 0) || settings.showUncheckAll || settings.showEnableSearchButton" class="divider"></li>' ;
41+ template += '<li ng-if="(settings.showCheckAll && settings.selectionLimit > 0) || settings.showUncheckAll || settings.showEnableSearchButton || currentGroups " class="divider"></li>' ;
4242 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);" ng-style="{width: \'100%\'}" ng-model="input.searchFilter" placeholder="{{texts.searchPlaceholder}}" /></li>' ;
4343 template += '<li ng-if="settings.enableSearch" class="divider"></li>' ;
4444
@@ -160,15 +160,6 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
160160 }
161161 } ) ;
162162
163- $scope . $watch ( 'groups' , function ( newVal ) {
164- if ( newVal ) {
165- $scope . currentGroups = [ ] ;
166- for ( var i = 0 ; i < $scope . groups . length ; ++ i ) {
167- $scope . currentGroups . push ( { value : $scope . groups [ i ] , title : 'All ' + $scope . groups [ i ] } ) ;
168- }
169- }
170- } ) ;
171-
172163 $scope . selectCurrentGroup = function ( currentGroup ) {
173164 $scope . selectedGroup = currentGroup . value ;
174165 if ( $scope . orderedItems ) {
0 commit comments