}
- expandOrCollapse (){
+ expandOrCollapse() {
this.props.setExpanded(!this.state.expanded);
};
- onExpandChanged (){
+ onExpandChanged() {
this.setState({
expanded: this.props.columnGroup.getOriginalColumnGroup().isExpanded()
})
diff --git a/src/richGridExample/NameCellEditor.jsx b/src/richGridExample/NameCellEditor.jsx
index c48447b..b7c2a65 100644
--- a/src/richGridExample/NameCellEditor.jsx
+++ b/src/richGridExample/NameCellEditor.jsx
@@ -1,10 +1,9 @@
import React from 'react';
-import RefData from './RefData';
import * as PropTypes from 'prop-types';
-var KEY_BACKSPACE = 8;
-var KEY_DELETE = 46;
-var KEY_F2 = 113;
+const KEY_BACKSPACE = 8;
+const KEY_DELETE = 46;
+const KEY_F2 = 113;
// cell renderer for the proficiency column. this is a very basic cell editor,
export default class NameCellEditor extends React.Component {
@@ -20,9 +19,9 @@ export default class NameCellEditor extends React.Component {
// experience is similar to Excel
createInitialState(props) {
- var startValue;
- var putCursorAtEndOnFocus = false;
- var highlightAllOnFocus = false;
+ let startValue;
+ const putCursorAtEndOnFocus = false;
+ const highlightAllOnFocus = false;
if (props.keyPress === KEY_BACKSPACE || props.keyPress === KEY_DELETE) {
// if backspace or delete pressed, we clear the cell
@@ -56,7 +55,7 @@ export default class NameCellEditor extends React.Component {
onChangeListener(event) {
// if doing React, you will probably be using a library for managing immutable
// objects better. to keep this example simple, we don't use one.
- var newState = {
+ const newState = {
value: event.target.value,
putCursorAtEndOnFocus: this.state.putCursorAtEndOnFocus,
highlightAllOnFocus: this.state.highlightAllOnFocus
@@ -73,7 +72,7 @@ export default class NameCellEditor extends React.Component {
// view, it may not yet be in the browser (put in by ag-Grid) so focus will not work
afterGuiAttached() {
// get ref from React component
- var eInput = this.refs.textField;
+ const eInput = this.refs.textField;
eInput.focus();
if (this.highlightAllOnFocus) {
eInput.select();
@@ -82,7 +81,7 @@ export default class NameCellEditor extends React.Component {
// this comes into play in two scenarios: a) when user hits F2 and b)
// when user hits a printable character, then on IE (and only IE) the carot
// was placed after the first character, thus 'apply' would end up as 'pplea'
- var length = eInput.value ? eInput.value.length : 0;
+ const length = eInput.value ? eInput.value.length : 0;
if (length > 0) {
eInput.setSelectionRange(length, length);
}
@@ -101,7 +100,7 @@ export default class NameCellEditor extends React.Component {
// just to demonstrate, if you type in 'cancel' then the edit will not take effect
isCancelAfterEnd() {
- if (this.state.value && this.state.value.toUpperCase()==='CANCEL') {
+ if (this.state.value && this.state.value.toUpperCase() === 'CANCEL') {
return true;
} else {
return false;
diff --git a/src/richGridExample/ProficiencyCellRenderer.jsx b/src/richGridExample/ProficiencyCellRenderer.jsx
index 5bc412b..d2760de 100644
--- a/src/richGridExample/ProficiencyCellRenderer.jsx
+++ b/src/richGridExample/ProficiencyCellRenderer.jsx
@@ -1,5 +1,4 @@
import React from 'react';
-import RefData from './RefData';
// cell renderer for the proficiency column. this is a very basic cell renderer,
// it is arguable that we should not of used React and just returned a string of
@@ -7,7 +6,7 @@ import RefData from './RefData';
export default class ProficiencyCellRenderer extends React.Component {
render() {
- var backgroundColor;
+ let backgroundColor;
if (this.props.value < 20) {
backgroundColor = 'red';
} else if (this.props.value < 60) {
@@ -17,7 +16,7 @@ export default class ProficiencyCellRenderer extends React.Component {
}
return (
-
+
{this.props.value}%
);
diff --git a/src/richGridExample/ProficiencyFilter.jsx b/src/richGridExample/ProficiencyFilter.jsx
index c52afb7..a88884b 100644
--- a/src/richGridExample/ProficiencyFilter.jsx
+++ b/src/richGridExample/ProficiencyFilter.jsx
@@ -1,13 +1,13 @@
import React from 'react';
-var PROFICIENCY_NAMES = ['No Filter', 'Above 40%', 'Above 60%', 'Above 80%'];
+const PROFICIENCY_NAMES = ['No Filter', 'Above 40%', 'Above 60%', 'Above 80%'];
// the proficiency filter component. this demonstrates how to integrate
// a React filter component with ag-Grid.
export default class ProficiencyFilter extends React.Component {
constructor(props) {
- super();
+ super(props);
this.state = {
selected: PROFICIENCY_NAMES[0]
};
@@ -15,14 +15,18 @@ export default class ProficiencyFilter extends React.Component {
// called by agGrid
doesFilterPass(params) {
- var value = this.props.valueGetter(params);
- var valueAsNumber = parseFloat(value);
+ const value = this.props.valueGetter(params);
+ const valueAsNumber = parseFloat(value);
switch (this.state.selected) {
- case PROFICIENCY_NAMES[1] : return valueAsNumber >= 40;
- case PROFICIENCY_NAMES[2] : return valueAsNumber >= 60;
- case PROFICIENCY_NAMES[3] : return valueAsNumber >= 80;
- default : return true;
+ case PROFICIENCY_NAMES[1] :
+ return valueAsNumber >= 40;
+ case PROFICIENCY_NAMES[2] :
+ return valueAsNumber >= 60;
+ case PROFICIENCY_NAMES[3] :
+ return valueAsNumber >= 80;
+ default :
+ return true;
}
};
@@ -32,7 +36,7 @@ export default class ProficiencyFilter extends React.Component {
};
onButtonPressed(name) {
- var newState = {selected: name};
+ const newState = {selected: name};
// set the state, and once it is done, then call filterChangedCallback
this.setState(newState, this.props.filterChangedCallback);
}
@@ -42,13 +46,14 @@ export default class ProficiencyFilter extends React.Component {
}
render() {
- var rows = [];
- PROFICIENCY_NAMES.forEach( (name)=> {
- var selected = this.state.selected === name;
+ const rows = [];
+ PROFICIENCY_NAMES.forEach((name) => {
+ const selected = this.state.selected === name;
rows.push(