File tree Expand file tree Collapse file tree 5 files changed +44
-6
lines changed Expand file tree Collapse file tree 5 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,29 @@ document$.subscribe(function() {
35
35
36
36
let columnIdx = el . getAttribute ( "data-column" ) ;
37
37
let column = dataTable . column ( columnIdx ) ;
38
+ let isColVisible = column . visible ( ) ;
38
39
39
- // Toggle the visibility
40
- column . visible ( ! column . visible ( ) ) ;
40
+ // Toggle the visibility of the column
41
+ column . visible ( ! isColVisible ) ;
42
+ // Toggle the highlighting of the button
43
+ if ( el . classList . contains ( "md-button-column-visible" ) ) {
44
+ el . classList . remove ( "md-button-column-visible" ) ;
45
+ } else {
46
+ el . classList . add ( "md-button-column-visible" ) ;
47
+ }
41
48
} ) ;
42
49
} ) ;
43
50
51
+ // Toggle on the visible buttons
52
+ document . querySelectorAll ( ".md-button.toggle-vis" ) . forEach ( ( el ) => {
53
+ if ( parseInt ( el . getAttribute ( "data-column" ) ) < 4 ) {
54
+ el . classList . add ( "md-button-column-visible" ) ;
55
+ }
56
+ } ) ;
57
+
58
+ // Toggle on the visible columns
44
59
let numCols = dataTable . columns ( ) . nodes ( ) . length ;
45
- if ( numCols > 4 ) {
60
+ if ( numCols >= 4 ) {
46
61
for ( let i = 4 ; i < numCols ; i ++ ) {
47
62
let column = dataTable . column ( i ) ;
48
63
column . visible ( false ) ;
Original file line number Diff line number Diff line change 17
17
.sorting_disabled {
18
18
font-size : 0.8rem ;
19
19
}
20
+
21
+ .md-button-column-visible {
22
+ background-color : royalblue;
23
+ }
Original file line number Diff line number Diff line change @@ -35,14 +35,29 @@ document$.subscribe(function() {
35
35
36
36
let columnIdx = el . getAttribute ( "data-column" ) ;
37
37
let column = dataTable . column ( columnIdx ) ;
38
+ let isColVisible = column . visible ( ) ;
38
39
39
- // Toggle the visibility
40
- column . visible ( ! column . visible ( ) ) ;
40
+ // Toggle the visibility of the column
41
+ column . visible ( ! isColVisible ) ;
42
+ // Toggle the highlighting of the button
43
+ if ( el . classList . contains ( "md-button-column-visible" ) ) {
44
+ el . classList . remove ( "md-button-column-visible" ) ;
45
+ } else {
46
+ el . classList . add ( "md-button-column-visible" ) ;
47
+ }
41
48
} ) ;
42
49
} ) ;
43
50
51
+ // Toggle on the visible buttons
52
+ document . querySelectorAll ( ".md-button.toggle-vis" ) . forEach ( ( el ) => {
53
+ if ( parseInt ( el . getAttribute ( "data-column" ) ) < 4 ) {
54
+ el . classList . add ( "md-button-column-visible" ) ;
55
+ }
56
+ } ) ;
57
+
58
+ // Toggle on the visible columns
44
59
let numCols = dataTable . columns ( ) . nodes ( ) . length ;
45
- if ( numCols > 4 ) {
60
+ if ( numCols >= 4 ) {
46
61
for ( let i = 4 ; i < numCols ; i ++ ) {
47
62
let column = dataTable . column ( i ) ;
48
63
column . visible ( false ) ;
Original file line number Diff line number Diff line change 17
17
.sorting_disabled {
18
18
font-size : 0.8rem ;
19
19
}
20
+
21
+ .md-button-column-visible {
22
+ background-color : royalblue;
23
+ }
You can’t perform that action at this time.
0 commit comments