Skip to content

Commit cd447b6

Browse files
Stijn DeschuymerAkshat55
andauthored
fix: map disabled values to itemValueKey on clearSelected (#3064)
Co-authored-by: Akshat Patel <[email protected]>
1 parent bcc505f commit cd447b6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/combobox/combobox.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,15 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
694694
// clearSelected can only fire on type=multi
695695
// so we just emit getSelected() (just in case there's any disabled but selected items)
696696
const selected = this.view.getSelected();
697-
this.propagateChangeCallback(selected);
697+
698+
// in case there are disabled items they should be mapped according to itemValueKey
699+
if (this.itemValueKey && selected) {
700+
const values = selected.map((item) => item[this.itemValueKey]);
701+
this.propagateChangeCallback(values);
702+
} else {
703+
this.propagateChangeCallback(selected);
704+
}
705+
698706
this.selected.emit(selected as any);
699707
this.clear.emit(event);
700708
}

0 commit comments

Comments
 (0)