Skip to content

Commit 3c6647c

Browse files
author
pkempenaers
committed
Merge branch 'develop'
2 parents 329b05c + 792ce8f commit 3c6647c

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/app/component/dropdownTree.controller.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
appendToElement: this.$element.children(),
5858
foldersOpen: true,
5959
openFolderWhenInnerSelected: false,
60+
closeOnSelectionLimitReached: false,
6061
};
6162

6263
this.settings = angular.extend({}, this.defaultSettings);
@@ -165,6 +166,11 @@
165166
});
166167
}
167168
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+
}
168174
}
169175

170176
dropdownToggleKeyDown(event) {

src/app/main/main.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
}
4444
return 'Select items';
4545
},
46+
closeOnSelectionLimitReached: false,
4647
};
4748
}
4849

src/app/main/main.template.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ <h3>Example settings</h3>
105105
folderSelectable
106106
</label>
107107
</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>
108116
</div>
109117
</div>
110118
</div>
@@ -277,6 +285,14 @@ <h3>Settings</h3>
277285
Only applicable when foldersOpen set to false. Will still open a folder when a child is selected.
278286
</td>
279287
</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>
280296
</tbody>
281297
</table>
282298
</div>

0 commit comments

Comments
 (0)