File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 57
57
appendToElement : this . $element . children ( ) ,
58
58
foldersOpen : true ,
59
59
openFolderWhenInnerSelected : false ,
60
+ closeOnSelectionLimitReached : false ,
60
61
} ;
61
62
62
63
this . settings = angular . extend ( { } , this . defaultSettings ) ;
165
166
} ) ;
166
167
}
167
168
this . selectionChanged ( { selection : this . selectedOptions } ) ;
169
+ if ( this . settings . closeOnSelectionLimitReached &&
170
+ this . settings . selectionLimit !== 0 &&
171
+ this . selectedOptions . length === this . settings . selectionLimit ) {
172
+ this . toggleDropdown ( ) ;
173
+ }
168
174
}
169
175
170
176
dropdownToggleKeyDown ( event ) {
Original file line number Diff line number Diff line change 43
43
}
44
44
return 'Select items' ;
45
45
} ,
46
+ closeOnSelectionLimitReached : false ,
46
47
} ;
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -105,6 +105,14 @@ <h3>Example settings</h3>
105
105
folderSelectable
106
106
</ label >
107
107
</ div >
108
+ < div >
109
+ < label >
110
+ < input type ="checkbox "
111
+ ng-model ="$ctrl.settings.closeOnSelectionLimitReached "
112
+ ng-change ="$ctrl.changeSettings() " />
113
+ closeOnSelectionLimitReached
114
+ </ label >
115
+ </ div >
108
116
</ div >
109
117
</ div >
110
118
</ div >
@@ -277,6 +285,14 @@ <h3>Settings</h3>
277
285
Only applicable when foldersOpen set to false. Will still open a folder when a child is selected.
278
286
</ td >
279
287
</ tr >
288
+ < tr >
289
+ < td > closeOnSelectionLimitReached</ td >
290
+ < td > false</ td >
291
+ < td > boolean</ td >
292
+ < td >
293
+ Only applicable when selectionLimit different from 0. Will close the dropdown when selection reaches the specified selectionLimit
294
+ </ td >
295
+ </ tr >
280
296
</ tbody >
281
297
</ table >
282
298
</ div >
You can’t perform that action at this time.
0 commit comments