From 4a6edc8a0d014c1ed48b27544cce53579b8fbf6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20FINDIKLI?= Date: Fri, 28 Dec 2018 13:19:41 +0300 Subject: [PATCH] fixed #7047 Multiselect Headercheckbox not working correctly --- src/app/components/multiselect/multiselect.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index 9e421d7bf28..5e054edadf6 100644 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -372,7 +372,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.value.length == this.visibleOptions.length); + return this.value && this.visibleOptions&&this.visibleOptions.length && this.isVisibleOptionsAllChecked(); } else { let optionCount = this.getEnabledOptionCount(); @@ -381,6 +381,20 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV } } + isVisibleOptionsAllChecked() { + if (!this.visibleOptions) { + return false; + } + else { + for (let option of this.visibleOptions) { + if (!this.value.find(value => value == option.value)) { + return false; + } + } + return true; + } + } + getEnabledOptionCount(): number { if (this.options) { let count = 0;