#1485 - add clean input search on close (#1498)

This commit is contained in:
Vito 2017-01-18 06:56:11 -08:00 committed by Maurizio Vitale
parent a0ccd6c8b3
commit 4653b9ad23
2 changed files with 10 additions and 4 deletions

View File

@ -59,7 +59,9 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
.valueChanges .valueChanges
.debounceTime(200) .debounceTime(200)
.subscribe((event) => { .subscribe((event) => {
this.onSearch.emit(event); if (event) {
this.onSearch.emit(event);
}
}); });
} }
@ -93,7 +95,11 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
getDisplayUser(user: User): string { getDisplayUser(user: User): string {
let firstName = user.firstName && user.firstName !== 'null' ? user.firstName : 'N/A'; let firstName = user.firstName && user.firstName !== 'null' ? user.firstName : 'N/A';
let lastName = user.lastName && user.lastName !== 'null' ? user.lastName : 'N/A'; let lastName = user.lastName && user.lastName !== 'null' ? user.lastName : 'N/A';
return firstName + ' - ' + lastName; return firstName + ' - ' + lastName;
} }
cleanSearch() {
this.searchUser.reset();
}
} }

View File

@ -25,11 +25,11 @@
<activiti-people-search (onSearch)="searchUser($event)" <activiti-people-search (onSearch)="searchUser($event)"
(onRowClicked)="involveUser($event)" (onRowClicked)="involveUser($event)"
[results]="peopleSearch$" [results]="peopleSearch$"
[iconImageUrl]="iconImageUrl"> [iconImageUrl]="iconImageUrl" #activitipeoplesearch>
</activiti-people-search> </activiti-people-search>
</div> </div>
<div class="mdl-dialog__actions"> <div class="mdl-dialog__actions">
<button type="button" id="close-people-dialog" (click)="cancel()" class="mdl-button close"> <button type="button" id="close-people-dialog" (click)="activitipeoplesearch.cleanSearch();cancel()" class="mdl-button close">
{{'PEOPLE.DIALOG_CLOSE' | translate }} {{'PEOPLE.DIALOG_CLOSE' | translate }}
</button> </button>
</div> </div>