@@ -21,15 +21,20 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
21
21
template += '<li><a data-ng-click="selectAll()"><span class="glyphicon glyphicon-ok"></span> Check All</a>' ;
22
22
template += '<li><a data-ng-click="deselectAll();"><span class="glyphicon glyphicon-remove"></span> Uncheck All</a></li>' ;
23
23
template += '<li class="divider"></li>' ;
24
+ template += '<li ng-show="settings.enableSearch"><input type="text" class="form-control" ng-model="searchFilter" /></li>' ;
25
+ template += '<li ng-show="settings.enableSearch" class="divider"></li>' ;
26
+ template += '<li data-ng-repeat="option in watchedOptions | filter: searchFilter"><a ng-click="setSelectedItem(getPropertyForObject(option,settings.idProp))">' ;
24
27
25
28
if ( checkboxes )
26
29
{
27
- template += '<li data-ng-repeat="option in watchedOptions"><a ng-click="setSelectedItem(getPropertyForObject(option,settings.idProp))">< div class="checkbox"><label><input class="checkboxInput" type="checkbox" ng-click="checkboxClick($event, getPropertyForObject(option,settings.idProp))" ng-checked="isChecked(getPropertyForObject(option,settings.idProp))" /> {{getPropertyForObject(option, settings.displayProp)}}</label></div></a></li >' ;
30
+ template += '<div class="checkbox"><label><input class="checkboxInput" type="checkbox" ng-click="checkboxClick($event, getPropertyForObject(option,settings.idProp))" ng-checked="isChecked(getPropertyForObject(option,settings.idProp))" /> {{getPropertyForObject(option, settings.displayProp)}}</label></div></a>' ;
28
31
}
29
32
else {
30
- template += '<li data-ng-repeat="option in watchedOptions"><a ng-click="setSelectedItem(getPropertyForObject(option,settings.idProp))">< span data-ng-class="{\'glyphicon glyphicon-ok\': isChecked(getPropertyForObject(option,settings.idProp))}"></span> {{getPropertyForObject(option, settings.displayProp)}}</a></li >' ;
33
+ template += '<span data-ng-class="{\'glyphicon glyphicon-ok\': isChecked(getPropertyForObject(option,settings.idProp))}"></span> {{getPropertyForObject(option, settings.displayProp)}}</a>' ;
31
34
}
32
35
36
+ template += '</li>' ;
37
+
33
38
template += '</ul>' ;
34
39
template += '</div>' ;
35
40
@@ -52,13 +57,16 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
52
57
$scope . watchedOptions = angular . copy ( $scope . options ) ;
53
58
} , true ) ;
54
59
60
+ $scope . searchFilter = '' ;
61
+
55
62
$scope . settings = {
56
63
dynamicTitle : true ,
57
64
defaultText : 'Select' ,
58
65
closeOnBlur : true ,
59
66
displayProp : 'label' ,
60
67
idProp : 'id' ,
61
- externalIdProp : 'id' } ;
68
+ externalIdProp : 'id' ,
69
+ enableSearch : false } ;
62
70
63
71
angular . extend ( $scope . settings , $scope . extraSettings || [ ] ) ;
64
72
0 commit comments