From cd447b6cf13310f650036572419c15f1b81e3470 Mon Sep 17 00:00:00 2001 From: Stijn Deschuymer Date: Fri, 22 Nov 2024 19:01:41 +0100 Subject: [PATCH] fix: map disabled values to itemValueKey on clearSelected (#3064) Co-authored-by: Akshat Patel <38994122+Akshat55@users.noreply.github.com> --- src/combobox/combobox.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/combobox/combobox.component.ts b/src/combobox/combobox.component.ts index d1397b97e6..8d079e158a 100644 --- a/src/combobox/combobox.component.ts +++ b/src/combobox/combobox.component.ts @@ -694,7 +694,15 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD // clearSelected can only fire on type=multi // so we just emit getSelected() (just in case there's any disabled but selected items) const selected = this.view.getSelected(); - this.propagateChangeCallback(selected); + + // in case there are disabled items they should be mapped according to itemValueKey + if (this.itemValueKey && selected) { + const values = selected.map((item) => item[this.itemValueKey]); + this.propagateChangeCallback(values); + } else { + this.propagateChangeCallback(selected); + } + this.selected.emit(selected as any); this.clear.emit(event); }