Skip to content

Instantly share code, notes, and snippets.

@bipon68
Created January 21, 2020 13:11
Show Gist options
  • Save bipon68/d9e275b286b8ec9b8b589a002ba6fbfc to your computer and use it in GitHub Desktop.
Save bipon68/d9e275b286b8ec9b8b589a002ba6fbfc to your computer and use it in GitHub Desktop.
PrimeNG Filter Button with table
<div class="lis-filter mb-10">
<div class="mb-10 text-right">
<p-selectButton [options]="buttonTypes" [(ngModel)]="selectedTypeOrderType" (click)="filterLISListByStatus()">
</p-selectButton>
</div>
</div>
<p-button label="Add Vendor" class="mb-10" icon="fa fa-plus"></p-button>
<div class="ui-g-12 ui-md-12">
<div class="lab-filter-table1" *ngIf="selectedTypeOrderType === 'ITEMCAT'">
<h3>Table 1</h3>
</div>
<div class="lab-filter-table2" *ngIf="selectedTypeOrderType === 'MANUFAC'">
<h3>Table 2</h3>
</div>
<div class="lab-filter-table3" *ngIf="selectedTypeOrderType === 'VEN'">
<h3>Table 3</h3>
</div>
<div class="lab-filter-table4" *ngIf="selectedTypeOrderType === 'VENITEM'">
<h3>Table 4</h3>
</div>
</div>
buttonTypes: SelectItem[];
selectedTypeOrderType: string;
vendorItem: any;
constructor() { }
public ngOnInit() {
this.selectedTypeOrderType = "ITEMCAT";
this.buttonTypes = [
{ label: "Item Category", value: "ITEMCAT" },
{ label: "Manufacturer", value: "MANUFAC" },
{ label: "Vendor", value: "VEN" },
{ label: "Item", value: "VENITEM" }
];
this.vendorItem = [
{clientName: "John Doe",patientName: "John doe",veterinarianName: "Mike Hussy",arrivalDate: "10-11-2018", waitingTime: "10-11-2018", status: "N"},
{clientName: "John Doe",patientName: "John doe",veterinarianName: "Mike Hussy",arrivalDate: "10-11-2018", waitingTime: "10-11-2018", status: "N"},
{clientName: "John Doe",patientName: "John doe",veterinarianName: "Mike Hussy",arrivalDate: "10-11-2018", waitingTime: "10-11-2018", status: "N"},
{clientName: "John Doe",patientName: "John doe",veterinarianName: "Mike Hussy",arrivalDate: "10-11-2018", waitingTime: "10-11-2018", status: "N"}
];
}
filterLISListByStatus() {
if (this.selectedTypeOrderType == "ITEMCAT") {
console.log('ITEMCAT');
}
else if (this.selectedTypeOrderType == "MANUFAC") {
console.log('MANUFAC');
}
else if (this.selectedTypeOrderType == "VEN") {
console.log('VEN');
}
else if (this.selectedTypeOrderType == "VENITEM") {
console.log('VENITEM');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment