diff --git a/index.html b/index.html index 0ee551e..126238f 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,43 @@ margin-left: 4px; margin-right: 4px; } + + .customHeaderMenuButton{ + margin-top: 5px; + margin-left: 4px; + float: left; + } + + .customHeaderLabel{ + margin-left: 5px; + margin-top: 3px; + float: left; + } + + .customSortDownLabel{ + float: left; + margin-left: 10px; + margin-top: 5px; + } + + .customSortUpLabel{ + float: left; + margin-left: 3px; + margin-top: 4px; + } + + .customSortRemoveLabel{ + float: left; + font-size: 11px; + margin-left: 3px; + margin-top: 6px; + } + + .active { + color: cornflowerblue; + } + + .hidden { display:none; }
diff --git a/src-standard/ColDefFactory.jsx b/src-standard/ColDefFactory.jsx index ceca815..c70d348 100644 --- a/src-standard/ColDefFactory.jsx +++ b/src-standard/ColDefFactory.jsx @@ -25,7 +25,7 @@ export default class ColDefFactory { cellRenderer: countryCellRenderer, pinned: true, filterParams: {cellRenderer: countryCellRenderer, cellHeight: 20}} , - {headerName: "DOB", field: "dob", width: 90, enableRowGroup: true, enablePivot: true, filter:'date', cellRenderer: function(params) { + {headerName: "DOB", field: "dob", width: 110, enableRowGroup: true, enablePivot: true, filter:'date', cellRenderer: function(params) { return pad(params.value.getDate(), 2) + '/' + pad(params.value.getMonth() + 1, 2)+ '/' + params.value.getFullYear(); @@ -41,7 +41,7 @@ export default class ColDefFactory { // supply a React component filterFramework: SkillsFilter }, - {headerName: "Proficiency", field: "proficiency", width: 120, enableValue: true, + {headerName: "Proficiency", field: "proficiency", width: 135, enableValue: true, // supply a React component cellRendererFramework: ProficiencyCellRenderer, // supply a React component diff --git a/src-standard/MyReactHeaderComponent.jsx b/src-standard/MyReactHeaderComponent.jsx new file mode 100644 index 0000000..df4f659 --- /dev/null +++ b/src-standard/MyReactHeaderComponent.jsx @@ -0,0 +1,76 @@ +import React from 'react'; + +// Header component to be used as default for all the columns. +export default class MyReactHeaderComponent extends React.Component { + + constructor(props) { + super(props); + + this.props.column.addEventListener('sortChanged', this.onSortChanged.bind(this)); + + //The state of this component contains the current sort state of this column + //The possible values are: 'asc', 'desc' and '' + this.state = { + sorted: '' + } + } + + + render() { + let sortElements = []; + if (this.props.enableSorting){ + let downArrowClass = "customSortDownLabel " + (this.state.sorted === 'desc' ? " active" : ""); + let upArrowClass = "customSortUpLabel " + (this.state.sorted === 'asc' ? " active" : ""); + let removeArrowClass = "customSortRemoveLabel " + (this.state.sorted === '' ? " active" : ""); + + sortElements.push(