From 2008537aa3e9df3f3757ffcdaecba65acccb751c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:56:55 +0300 Subject: [PATCH] Fixed #14100 - MultiSelect | Refactor onChange --- src/app/components/multiselect/multiselect.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index 035dacfd6a7..b0c22da053d 100755 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -1175,11 +1175,6 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft this.value = value; this.onModelChange(value); this.modelValue.set(value); - - this.onChange.emit({ - originalEvent: event, - value: value - }); } onOptionSelect(event, isFocus = false, index = -1) { @@ -1201,6 +1196,12 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft index !== -1 && this.focusedOptionIndex.set(index); isFocus && DomHandler.focus(this.focusInputViewChild?.nativeElement); + + this.onChange.emit({ + originalEvent: event, + value: value, + itemValue: option + }); } onOptionSelectRange(event, start = -1, end = -1) { @@ -1776,9 +1777,8 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft writeValue(value: any): void { this.value = value; this.modelValue.set(this.value); - this.updateModel(this.value); + this.onModelChange(this.value) this.checkSelectionLimit(); - this.cd.markForCheck(); }