Skip to content

Commit

Permalink
#9532 for picklist
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Apr 28, 2021
1 parent 40ea710 commit d19716b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/components/picklist/picklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {ObjectUtils, UniqueComponentId} from 'primeng/utils';
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
</li>
</ng-template>
<ng-container *ngIf="(source == null || source.length === 0) && emptyMessageSourceTemplate">
<ng-container *ngIf="isEmpty(SOURCE_LIST) && emptyMessageSourceTemplate">
<li class="p-picklist-empty-message">
<ng-container *ngTemplateOutlet="emptyMessageSourceTemplate"></ng-container>
</li>
Expand Down Expand Up @@ -69,7 +69,7 @@ import {ObjectUtils, UniqueComponentId} from 'primeng/utils';
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
</li>
</ng-template>
<ng-container *ngIf="(target == null || target.length === 0) && emptyMessageTargetTemplate">
<ng-container *ngIf="isEmpty(TARGET_LIST) && emptyMessageTargetTemplate">
<li class="p-picklist-empty-message">
<ng-container *ngTemplateOutlet="emptyMessageTargetTemplate"></ng-container>
</li>
Expand Down Expand Up @@ -338,6 +338,14 @@ export class PickList implements AfterViewChecked,AfterContentInit {
return this.isVisibleInList(this.visibleOptionsTarget, item, this.filterValueTarget);
}

isEmpty(listType: number) {
if (listType == this.SOURCE_LIST)
return this.filterValueSource ? (!this.visibleOptionsSource || this.visibleOptionsSource.length === 0) : (!this.source || this.source.length === 0);
else
return this.filterValueTarget ? (!this.visibleOptionsTarget || this.visibleOptionsTarget.length === 0) : (!this.target || this.target.length === 0);
}


isVisibleInList(data: any[], item: any, filterValue: string): boolean {
if (filterValue && filterValue.trim().length) {
for(let i = 0; i < data.length; i++) {
Expand Down

0 comments on commit d19716b

Please sign in to comment.