Skip to content

Commit 36eb2b9

Browse files
edgardavid2015Edgar Guaman
andauthored
Tt 318 improve column visibility section (#740)
* style: TT-318 Improve column visibility * style: TT-318 Improve column visibility option * style: TT-318 Improving the print option * style: TT-318 Improving functionality in CSV and Excel buttons * style: TT-318 Deleting unnecessary variables * code-smell: TT-318 Fixing a code smell and rebase from master Co-authored-by: Edgar Guaman <[email protected]>
1 parent bf26092 commit 36eb2b9

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

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

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { formatDate } from '@angular/common';
22
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
33
import { select, Store } from '@ngrx/store';
44
import { DataTableDirective } from 'angular-datatables';
5-
import * as moment from 'moment';
65
import { Observable, Subject, Subscription } from 'rxjs';
76
import { Entry } from 'src/app/modules/shared/models';
87
import { DataSource } from 'src/app/modules/shared/models/data-source.model';
@@ -22,38 +21,31 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
2221
buttons: [
2322
{
2423
extend: 'colvis',
25-
columns: ':not(.hidden-col)',
24+
columns: ':not(.hidden-col),visible'
25+
},
26+
{
27+
extend: 'print',
28+
exportOptions: {
29+
columns: ':visible'
30+
}
2631
},
27-
'print',
2832
{
2933
extend: 'excel',
3034
exportOptions: {
31-
format: {
32-
body: (data, row, column, node) => {
33-
return column === 3 ?
34-
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
35-
data;
36-
},
37-
},
35+
columns: ':visible'
3836
},
3937
text: 'Excel',
40-
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`,
38+
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
4139
},
4240
{
4341
extend: 'csv',
4442
exportOptions: {
45-
format: {
46-
body: (data, row, column, node) => {
47-
return column === 3 ?
48-
moment.duration(data).asHours().toFixed(4).slice(0, -1) :
49-
data;
50-
},
51-
},
43+
columns: ':visible'
5244
},
5345
text: 'CSV',
54-
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')}`
5547
},
56-
],
48+
]
5749
};
5850
dtTrigger: Subject<any> = new Subject();
5951
@ViewChild(DataTableDirective, { static: false })

src/styles.scss

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,32 @@ Overwritten calendar style
6161
.cal-header .cal-cell {
6262
border: 0.1px solid lighten($primary-text, 30%);
6363
}
64+
65+
@media (max-width: 640px) {
66+
div.dt-buttons {
67+
text-align: start !important;
68+
}
69+
.dataTables_wrapper .dataTables_filter {
70+
text-align: start !important;
71+
}
72+
div.dt-button-collection {
73+
position: fixed !important;
74+
top: 250px !important;
75+
margin-left: 50px !important;
76+
overflow-y: scroll !important;
77+
max-height: 300px !important;
78+
button.active:not(.disabled) {
79+
background: $primary !important;
80+
box-shadow: none !important;
81+
}
82+
}
83+
}
84+
85+
@media (min-width: 576px) {
86+
div.dt-button-collection {
87+
button.active:not(.disabled) {
88+
background: $primary !important;
89+
box-shadow: none !important;
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)