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,
};
我无法在“选择所有过滤的结果”中应用函数调用,或者无法将其禁用。但是“全选”也可以使用。
答案 0 :(得分:1)
在您的下拉设置中:
this.dropdownSettings = {
singleSelection: true,
idField: 'item_id',
textField: 'item_text',
itemsShowLimit: 3,
allowSearchFilter: false,
};
<块引用>
singleSelection: true,
答案 1 :(得分:0)
您的问题是“在AngularJS Dropdown Multiselect中“ 全选”时如何禁用禁用项目的选择吗?
您必须修改angularjs-dropdown-multiselect.min.js
文件(我使用的是缩小文件),您已经下载了该文件才能使用此文件...您将其称为...东西。
selectAll()
功能必须更改为仅选择非禁用项目。
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;
}
来源:https://github.com/dotansimha/angularjs-dropdown-multiselect/issues/361