Skip to content

Commit

Permalink
fix: map disabled values to itemValueKey on clearSelected (#3064)
Browse files Browse the repository at this point in the history
Co-authored-by: Akshat Patel <[email protected]>
  • Loading branch information
stijndeschuymer and Akshat55 authored Nov 22, 2024
1 parent bcc505f commit cd447b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/combobox/combobox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit cd447b6

Please sign in to comment.