Skip to content

Commit

Permalink
primefaces#9579 Multiselect on chips display - adding onChange emit
Browse files Browse the repository at this point in the history
andriy101 committed Dec 8, 2020
1 parent 9918236 commit 5b13180
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ export class MultiSelectItem {
<ng-container *ngIf="display === 'chip'">
<div #token *ngFor="let item of value; let i = index;" class="p-multiselect-token">
<span class="p-multiselect-token-label">{{findLabelByValue(item)}}</span>
<span *ngIf="!disabled" class="p-multiselect-token-icon pi pi-times-circle" (click)="removeChip(item)"></span>
<span *ngIf="!disabled" class="p-multiselect-token-icon pi pi-times-circle" (click)="removeChip(item, $event)"></span>
</div>
<ng-container *ngIf="!value || value.length === 0">{{placeholder || defaultLabel || 'empty'}}</ng-container>
</ng-container>
@@ -664,9 +664,10 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV
}
}

removeChip(chip: any) {
removeChip(chip: any, event: MouseEvent) {
this.value = this.value.filter(val => !ObjectUtils.equals(val, chip, this.dataKey));
this.onModelChange(this.value);
this.onChange.emit({ originalEvent: event, value: this.value });
this.updateFilledState();
}

0 comments on commit 5b13180

Please sign in to comment.