Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 4193653

Browse files
authored
Merge pull request #6 from briebugconsulting/grid-download
feat(grid-download): download button with event
2 parents 52741af + b76266d commit 4193653

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/components/header.template.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export const HEADER_TEMPLATE = `
1010
(click)="columnSelectorOpen = !columnSelectorOpen; $event.stopPropagation()" >
1111
<i class="fa fa-list fa-lg"></i>
1212
</button>
13+
<button *ngIf="dataTable.showDownloadButton" type="button" class="btn btn-default btn-sm download-button"
14+
(click)="dataTable.downloadItems()">
15+
<i class="fa fa-download fa-lg"></i>
16+
</button>
1317
<div class="column-selector-wrapper" (click)="$event.stopPropagation()">
1418
<div *ngIf="columnSelectorOpen" class="column-selector-box panel panel-default">
1519
<div *ngIf="dataTable.expandableRows" class="column-selector-fixed-column checkbox">

src/components/table.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class DataTable implements DataTableParams, OnInit {
5656
@Input() selectOnRowClick = false;
5757
@Input() autoReload = true;
5858
@Input() showReloading = false;
59+
@Input() showDownloadButton = false;
5960

6061
// UI state without input:
6162

@@ -207,6 +208,13 @@ export class DataTable implements DataTableParams, OnInit {
207208
});
208209
}
209210

211+
// Download
212+
@Output() download = new EventEmitter();
213+
214+
downloadItems(){
215+
this.download.emit(this._getRemoteParameters());
216+
}
217+
210218
// event handlers:
211219

212220
@Output() rowClick = new EventEmitter();

0 commit comments

Comments
 (0)