Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

Commit 3ee9883

Browse files
committed
Merge pull request #11 from spotlmnop/master
Scrollable multiselect - Added two settings scrollable and scrollableHei...
2 parents e198404 + 34f0ebf commit 3ee9883

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pages/javascripts/pages/home/home.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,18 @@ <h2>Settings</h2>
609609
<td>angular.noop</td>
610610
<td>A callback to a function that provide that name for each group when using group-by attribute. The parameter for the function will be the value of the group-by property.</td>
611611
</tr>
612+
<tr>
613+
<td>scrollable</td>
614+
<td>Boolean</td>
615+
<td>false</td>
616+
<td>Indicates if the dropdown is scrollable, useful if you have a lot of items.</td>
617+
</tr>
618+
<tr>
619+
<td>scrollableHeight</td>
620+
<td>Number</td>
621+
<td>300px</td>
622+
<td>Indicates the height of the drop down if the dropdown is scrollable.</td>
623+
</tr>
612624
</tbody>
613625
</table>
614626
<h2>Events</h2>

src/angularjs-dropdown-multiselect.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
2020

2121
var template = '<div class="multiselect-parent btn-group dropdown-multiselect">';
2222
template +='<button type="button" class="dropdown-toggle" ng-class="settings.buttonClasses" ng-click="toggleDropdown()">{{getButtonText()}}<span class="caret"></span></button>';
23-
template += '<ul class="dropdown-menu dropdown-menu-form" ng-style="{display: open ? \'block\' : \'none\'}">';
23+
template += '<ul class="dropdown-menu dropdown-menu-form" ng-style="{display: open ? \'block\' : \'none\', height : settings.scrollable ? \'settings.scrollableHeight\' : \'auto\' }" style="overflow: scroll" >';
2424
template += '<li ng-hide="!settings.showCheckAll || settings.selectionLimit > 0"><a data-ng-click="selectAll()"><span class="glyphicon glyphicon-ok"></span> {{texts.checkAll}}</a>';
2525
template += '<li ng-show="settings.showUncheckAll"><a data-ng-click="deselectAll();"><span class="glyphicon glyphicon-remove"></span> {{texts.uncheckAll}}</a></li>';
2626
template += '<li ng-hide="(!settings.showCheckAll || settings.selectionLimit > 0) && !settings.showUncheckAll" class="divider"></li>';
@@ -81,6 +81,8 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
8181

8282
$scope.settings = {
8383
dynamicTitle: true,
84+
scrollable: false,
85+
scrollableHeight: '300px',
8486
closeOnBlur: true,
8587
displayProp: 'label',
8688
idProp: 'id',

0 commit comments

Comments
 (0)