Skip to content

Commit

Permalink
Refactored #7047 to use the same isSelected check
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Dec 31, 2018
1 parent 53d6b9a commit b119c50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV
return index;
}

toggleAll(event) {
toggleAll(event: Event) {
if (this.isAllChecked()) {
this.value = [];
}
Expand All @@ -428,7 +428,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV

isAllChecked() {
if (this.filterValue && this.filterValue.trim().length) {
return this.value && this.visibleOptions&&this.visibleOptions.length && this.isVisibleOptionsAllChecked();
return this.value && this.visibleOptions && this.visibleOptions.length && this.isAllVisibleOptionsChecked();
}
else {
let optionCount = this.getEnabledOptionCount();
Expand All @@ -437,13 +437,13 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV
}
}

isVisibleOptionsAllChecked() {
isAllVisibleOptionsChecked() {
if (!this.visibleOptions) {
return false;
}
else {
for (let option of this.visibleOptions) {
if (!this.value.find(value => value == option.value)) {
if (!this.isSelected(option.value)) {
return false;
}
}
Expand Down

0 comments on commit b119c50

Please sign in to comment.