Skip to content

Commit ec706a0

Browse files
committed
fix(combobox): emit selected when the selection is cleared
1 parent b031235 commit ec706a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/combobox/combobox.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
351351
});
352352
this.view["updateList"](this.items);
353353
this.updatePills();
354+
// clearSelected can only fire on type=multi
355+
// so we just emit getSelected() (just in case there's any disabled but selected items)
356+
this.selected.emit(this.view.getSelected() as any);
354357
}
355358

356359
/**

src/combobox/combobox.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ storiesOf("Combobox", module)
1616
.addDecorator(withKnobs)
1717
.add("Basic", () => ({
1818
template: `
19-
<ibm-combo-box [items]="items">
19+
<ibm-combo-box [items]="items" (selected)="selected($event)">
2020
<ibm-dropdown-list></ibm-dropdown-list>
2121
</ibm-combo-box>
2222
`,
@@ -40,7 +40,7 @@ storiesOf("Combobox", module)
4040
}))
4141
.add("Multi-select", () => ({
4242
template: `
43-
<ibm-combo-box [items]="items" type="multi">
43+
<ibm-combo-box [items]="items" type="multi" (selected)="selected($event)">
4444
<ibm-dropdown-list></ibm-dropdown-list>
4545
</ibm-combo-box>
4646
`,

0 commit comments

Comments
 (0)