From 3a9b720d79b102e14c6502df54aaa630523295eb Mon Sep 17 00:00:00 2001 From: Adam Buckingham Date: Mon, 4 Nov 2024 13:46:58 -0500 Subject: [PATCH 1/2] Adjusting the CSV Download based on the filtering --- .../solicitation-report.component.html | 4 ++-- .../solicitation-report/solicitation-report.component.ts | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/solicitation/solicitation-report/solicitation-report.component.html b/src/app/solicitation/solicitation-report/solicitation-report.component.html index 7af18e35..0e910e90 100644 --- a/src/app/solicitation/solicitation-report/solicitation-report.component.html +++ b/src/app/solicitation/solicitation-report/solicitation-report.component.html @@ -51,8 +51,8 @@

+ src="../../../assets/downloadcsv.jpeg" style="float:left" (keydown.enter)="exportCSV({}, gb.filters)" + (click)="exportCSV({}, gb.filters)">
diff --git a/src/app/solicitation/solicitation-report/solicitation-report.component.ts b/src/app/solicitation/solicitation-report/solicitation-report.component.ts index ca076227..9ea2d4f4 100644 --- a/src/app/solicitation/solicitation-report/solicitation-report.component.ts +++ b/src/app/solicitation/solicitation-report/solicitation-report.component.ts @@ -347,7 +347,7 @@ export class SolicitationReportComponent extends BaseComponent implements OnInit * * @param options */ - exportCSV (options) { + exportCSV (options, filters) { const csvSeparator = ','; let csv = ''; @@ -367,7 +367,12 @@ export class SolicitationReportComponent extends BaseComponent implements OnInit } } - const filter = {first: 0, rows: 1000}; + let filter = {first: 0, rows: 1000, filters: {}}; + + if (filters) { + filter.filters = filters; + } + const appendSolicitations = (solicitations) => { document.body.style.cursor = 'wait'; for (const s of solicitations.predictions) { From b2a7d460c1cf16ff3ab116fe7e23f4877ffff701 Mon Sep 17 00:00:00 2001 From: Adam Buckingham Date: Mon, 4 Nov 2024 14:52:39 -0500 Subject: [PATCH 2/2] Adding extra documentation --- .../solicitation-report/solicitation-report.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/solicitation/solicitation-report/solicitation-report.component.ts b/src/app/solicitation/solicitation-report/solicitation-report.component.ts index 9ea2d4f4..e794d2d1 100644 --- a/src/app/solicitation/solicitation-report/solicitation-report.component.ts +++ b/src/app/solicitation/solicitation-report/solicitation-report.component.ts @@ -346,6 +346,7 @@ export class SolicitationReportComponent extends BaseComponent implements OnInit * Copied from the PrimeNG prototype and then modified * * @param options + * @param filters - Filter values associated with the soliciation p-table */ exportCSV (options, filters) { const csvSeparator = ','; @@ -369,6 +370,8 @@ export class SolicitationReportComponent extends BaseComponent implements OnInit let filter = {first: 0, rows: 1000, filters: {}}; + // The filters parameter is passed from the p-table element with the template reference variable #gb. + // It contains the current filtering criteria applied to the table, allowing the export to include only the filtered data. if (filters) { filter.filters = filters; } @@ -393,7 +396,7 @@ export class SolicitationReportComponent extends BaseComponent implements OnInit .subscribe(appendSolicitations); } }; - + this.solicitationService .getFilteredSolicitations(filter) .subscribe( appendSolicitations );