@@ -3,7 +3,7 @@ import Paper from '@material-ui/core/Paper';
33import { Plugin , Template , TemplatePlaceholder } from "@devexpress/dx-react-core" ;
44import { FilteringState , IntegratedFiltering , SortingState , IntegratedSorting } from '@devexpress/dx-react-grid' ;
55import { Grid , VirtualTable , TableHeaderRow , TableFilterRow , DragDropProvider ,
6- TableColumnReordering , TableColumnResizing , ColumnChooser , TableColumnVisibility ,
6+ TableColumnReordering , ColumnChooser , TableColumnVisibility ,
77 Toolbar ,
88 } from '@devexpress/dx-react-grid-material-ui' ;
99import DateRange from '@material-ui/icons/DateRange' ;
@@ -12,13 +12,20 @@ import { withStyles } from '@material-ui/core/styles';
1212import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
1313import { faTerminal } from '@fortawesome/free-solid-svg-icons'
1414import IconButton from '@material-ui/core/IconButton' ;
15+ import Tooltip from '@material-ui/core/Tooltip' ;
1516
1617const styles = theme => ( {
1718 tableStriped : {
1819 '& tbody tr:nth-of-type(odd)' : {
1920 backgroundColor : fade ( theme . palette . primary . main , 0.15 ) ,
2021 } ,
2122 } ,
23+ headerCell : {
24+ '&' : {
25+ color : '#000' ,
26+ fontWeight : 800 ,
27+ }
28+ } ,
2229} ) ;
2330
2431const FilterIcon = ( { type, ...restProps } ) => {
@@ -33,8 +40,16 @@ const TableComponentBase = ({ classes, ...restProps }) => (
3340 />
3441) ;
3542
43+ const TableHeaderComponentBase = ( { classes, ...restProps } ) => (
44+ < TableHeaderRow . Cell
45+ { ...restProps }
46+ className = { classes . headerCell }
47+ />
48+ ) ;
49+
3650const Root = props => < Grid . Root { ...props } style = { { height : '100%' } } /> ;
3751export const TableComponent = withStyles ( styles , { name : 'TableComponent' } ) ( TableComponentBase ) ;
52+ export const TableHeaderComponent = withStyles ( styles , { name : 'TableHeaderComponent' } ) ( TableHeaderComponentBase ) ;
3853
3954class TableRow extends React . PureComponent {
4055
@@ -57,9 +72,11 @@ class TableRow extends React.PureComponent {
5772 return (
5873 < Plugin name = "customToolbarMarkup" >
5974 < Template name = "toolbarContent" >
60- < IconButton aria-label = "Show Console" title = "Show Console" onClick = { ( ) => handleVisibleChange ( true ) } >
61- < FontAwesomeIcon icon = { faTerminal } size = "sm" />
62- </ IconButton >
75+ < Tooltip title = "Show Console" aria-label = "showConsole" >
76+ < IconButton aria-label = "consoleButton" onClick = { ( ) => handleVisibleChange ( true ) } >
77+ < FontAwesomeIcon icon = { faTerminal } size = "sm" />
78+ </ IconButton >
79+ </ Tooltip >
6380 < TemplatePlaceholder />
6481 </ Template >
6582 </ Plugin > )
@@ -88,15 +105,20 @@ class TableRow extends React.PureComponent {
88105 tableComponent = { TableComponent }
89106 />
90107 { /* <TableColumnResizing defaultColumnWidths /> */ }
91- < TableHeaderRow showSortingControls />
108+ < TableHeaderRow
109+ showSortingControls
110+ cellComponent = { TableHeaderComponent }
111+ />
92112 < TableColumnReordering
93113 defaultOrder = { columns . map ( column => column . name ) }
94114 />
95115 < TableFilterRow
96116 showFilterSelector
97117 iconComponent = { FilterIcon }
98118 />
99- < TableColumnVisibility />
119+ < TableColumnVisibility
120+ onHiddenColumnNamesChange = { change => console . info ( `Columns filtered: ${ change } ` ) }
121+ />
100122 < Toolbar />
101123 < ColumnChooser />
102124 < CustomToolbarMarkup />
0 commit comments