Reputation: 21
Html
<angular2-multiselect id="multi_select" name="multiselect" required
[disabled]="true"
[(ngModel)]="selected"
[data]="list"
(onSelect)="call()"
(onDeSelect)="call()" [settings]="dropDownSetting"
(onSelectAll)="call()"
(onDeSelectAll)="call()">
<span class="glyphicon glyphicon-filter"></span>
</angular2-multiselect>
TS
mySettings = {
singleSelection: false,
text: '',
selectAllText: 'Select All',
unSelectAllText: 'UnSelect All',
enableSearchFilter: true,
badgeShowLimit: 1,
};
I am not able to apply the function call in "Select all filtered result" or not able to disable it. But same is working with "Select All".
Upvotes: 2
Views: 3642
Reputation: 1323
In you dropdown Settings:
this.dropdownSettings = {
singleSelection: true,
idField: 'item_id',
textField: 'item_text',
itemsShowLimit: 3,
allowSearchFilter: false,
};
singleSelection: true,
Upvotes: 2
Reputation: 3845
Is your question "How do I disable selection of disabled items when I "select all" in AngularJS Dropdown Multiselect?
You have to modify the angularjs-dropdown-multiselect.min.js
file (I use the minified file), which you would have downloaded to use this... what do you call these... thing.
The selectAll()
function must be changed to only select the non-disabled items.
function selectAll() {
$scope.deselectAll(true);
$scope.externalEvents.onSelectAll();
var searchResult = $filter('filter')($scope.options, $scope.getFilter($scope.input.searchFilter));
var filteredResult = searchResult.filter(function (option) {
return !option.disabled;
});
angular.forEach(filteredResult, function(value) {
$scope.setSelectedItem(value, true, false);
});
$scope.externalEvents.onSelectionChanged();
$scope.selectedGroup = null;
}
Source: https://github.com/dotansimha/angularjs-dropdown-multiselect/issues/361
Upvotes: 0