Skip to content

Commit 3ea7a9a

Browse files
author
Edgar Guaman
committed
style: TT-318 Improving functionality in CSV and Excel buttons
1 parent a5aad06 commit 3ea7a9a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,31 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
3434
extend: 'excel',
3535
exportOptions: {
3636
format: {
37-
body: (data, row, column, node) => {
38-
return column === 3 ?
37+
body: (data, column) => {
38+
return column.name === 'Duration' ?
3939
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
4040
data;
4141
},
4242
},
43+
columns: ':visible'
4344
},
4445
text: 'Excel',
45-
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`,
46+
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
4647
},
4748
{
4849
extend: 'csv',
4950
exportOptions: {
5051
format: {
51-
body: (data, row, column, node) => {
52-
return column === 3 ?
52+
body: (data, column) => {
53+
return column.name === 'Duration' ?
5354
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
5455
data;
5556
},
5657
},
58+
columns: ':visible'
5759
},
5860
text: 'CSV',
59-
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`,
61+
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
6062
},
6163
]
6264
};

0 commit comments

Comments
 (0)