From 7075f57d88cdcbb236a08095e7c65c3fd4e8da67 Mon Sep 17 00:00:00 2001 From: Sean Landsman Date: Mon, 18 Sep 2017 16:03:27 +0100 Subject: [PATCH] Tidy examples --- .../FilterComponentExample.jsx | 8 +- .../FullWidthComponentExample.jsx | 8 +- .../RichComponentsExample.jsx | 8 +- src/richGridExample/HeaderGroupComponent.jsx | 9 +- src/richGridExample/NameCellEditor.jsx | 21 +- .../ProficiencyCellRenderer.jsx | 5 +- src/richGridExample/ProficiencyFilter.jsx | 39 +-- src/richGridExample/RefData.js | 223 +++++++++--------- src/richGridExample/RichGridExample.jsx | 5 +- src/richGridExample/RowDataFactory.js | 10 +- src/richGridExample/SkillsCellRenderer.jsx | 8 +- src/richGridExample/SkillsFilter.jsx | 16 +- .../SortableHeaderComponent.jsx | 13 +- 13 files changed, 194 insertions(+), 179 deletions(-) diff --git a/src/filterComponentExample/FilterComponentExample.jsx b/src/filterComponentExample/FilterComponentExample.jsx index 3e7eca4..44952d6 100644 --- a/src/filterComponentExample/FilterComponentExample.jsx +++ b/src/filterComponentExample/FilterComponentExample.jsx @@ -13,8 +13,8 @@ export default class FilterComponentExample extends Component { this.state = { gridOptions: {}, - rowData: this.createRowData(), - columnDefs: this.createColumnDefs(), + rowData: FilterComponentExample.createRowData(), + columnDefs: FilterComponentExample.createColumnDefs(), }; this.onGridReady = this.onGridReady.bind(this); @@ -32,7 +32,7 @@ export default class FilterComponentExample extends Component { this.gridApi.getFilterInstance("name").getFrameworkComponentInstance().componentMethod("Hello World!"); } - createColumnDefs() { + static createColumnDefs() { return [ {headerName: "Row", field: "row", width: 400}, { @@ -45,7 +45,7 @@ export default class FilterComponentExample extends Component { ]; } - createRowData() { + static createRowData() { return [ {"row": "Row 1", "name": "Michael Phelps"}, {"row": "Row 2", "name": "Natalie Coughlin"}, diff --git a/src/fullWidthExample/FullWidthComponentExample.jsx b/src/fullWidthExample/FullWidthComponentExample.jsx index 9cbd64b..14442d6 100644 --- a/src/fullWidthExample/FullWidthComponentExample.jsx +++ b/src/fullWidthExample/FullWidthComponentExample.jsx @@ -10,8 +10,8 @@ export default class FullWidthComponentExample extends Component { this.state = { gridOptions: {}, - rowData: this.createRowData(), - columnDefs: this.createColumnDefs() + rowData: FullWidthComponentExample.createRowData(), + columnDefs: FullWidthComponentExample.createColumnDefs() }; this.onGridReady = this.onGridReady.bind(this); @@ -28,7 +28,7 @@ export default class FullWidthComponentExample extends Component { return (rowNode.id === "0") || (parseInt(rowNode.id) % 2 === 0); } - createColumnDefs() { + static createColumnDefs() { return [ { headerName: "Name", @@ -43,7 +43,7 @@ export default class FullWidthComponentExample extends Component { ]; } - createRowData() { + static createRowData() { return [ {name: "Bob", age: 10}, {name: "Harry", age: 3}, diff --git a/src/richComponentExample/RichComponentsExample.jsx b/src/richComponentExample/RichComponentsExample.jsx index e066534..c1d1a11 100644 --- a/src/richComponentExample/RichComponentsExample.jsx +++ b/src/richComponentExample/RichComponentsExample.jsx @@ -9,8 +9,8 @@ export default class RichComponentsExample extends Component { super(props); this.state = { - rowData: this.createRowData(), - columnDefs: this.createColumnDefs() + rowData: RichComponentsExample.createRowData(), + columnDefs: RichComponentsExample.createColumnDefs() }; this.onGridReady = this.onGridReady.bind(this); @@ -23,7 +23,7 @@ export default class RichComponentsExample extends Component { this.gridApi.sizeColumnsToFit(); } - createColumnDefs() { + static createColumnDefs() { return [ { headerName: "Name", @@ -44,7 +44,7 @@ export default class RichComponentsExample extends Component { } ]; } - createRowData() { + static createRowData() { return [ {name: 'Homer Simpson', ratios: {top: 0.25, bottom: 0.75}}, {name: 'Marge Simpson', ratios: {top: 0.67, bottom: 0.39}}, diff --git a/src/richGridExample/HeaderGroupComponent.jsx b/src/richGridExample/HeaderGroupComponent.jsx index 9afcaef..30fc1da 100644 --- a/src/richGridExample/HeaderGroupComponent.jsx +++ b/src/richGridExample/HeaderGroupComponent.jsx @@ -17,19 +17,20 @@ export default class HeaderGroupComponent extends React.Component { } render() { - let arrowClassName = "customExpandButton " + (this.state.expanded ? " expanded": " collapsed"); + let arrowClassName = "customExpandButton " + (this.state.expanded ? " expanded" : " collapsed"); return
{this.props.displayName}
-
+
} - 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(
@@ -57,7 +62,13 @@ export default class ProficiencyFilter extends React.Component { return (
-
+
Custom Proficiency Filter
{rows} diff --git a/src/richGridExample/RefData.js b/src/richGridExample/RefData.js index 3ded99b..d5a2941 100644 --- a/src/richGridExample/RefData.js +++ b/src/richGridExample/RefData.js @@ -1,127 +1,128 @@ -export default class RefData {} +export default class RefData { +} RefData.FIRST_NAMES = [ - "Sophie", "Isabelle", "Emily", "Olivia", "Lily", "Chloe", "Isabella", - "Amelia", "Jessica", "Sophia", "Ava", "Charlotte", "Mia", "Lucy", "Grace", "Ruby", - "Ella", "Evie", "Freya", "Isla", "Poppy", "Daisy", "Layla" - ]; + "Sophie", "Isabelle", "Emily", "Olivia", "Lily", "Chloe", "Isabella", + "Amelia", "Jessica", "Sophia", "Ava", "Charlotte", "Mia", "Lucy", "Grace", "Ruby", + "Ella", "Evie", "Freya", "Isla", "Poppy", "Daisy", "Layla" +]; RefData.LAST_NAMES = [ - "Beckham", "Black", "Braxton", "Brennan", "Brock", "Bryson", "Cadwell", - "Cage", "Carson", "Chandler", "Cohen", "Cole", "Corbin", "Dallas", "Dalton", "Dane", - "Donovan", "Easton", "Fisher", "Fletcher", "Grady", "Greyson", "Griffin", "Gunner", - "Hayden", "Hudson", "Hunter", "Jacoby", "Jagger", "Jaxon", "Jett", "Kade", "Kane", - "Keating", "Keegan", "Kingston", "Kobe" - ]; + "Beckham", "Black", "Braxton", "Brennan", "Brock", "Bryson", "Cadwell", + "Cage", "Carson", "Chandler", "Cohen", "Cole", "Corbin", "Dallas", "Dalton", "Dane", + "Donovan", "Easton", "Fisher", "Fletcher", "Grady", "Greyson", "Griffin", "Gunner", + "Hayden", "Hudson", "Hunter", "Jacoby", "Jagger", "Jaxon", "Jett", "Kade", "Kane", + "Keating", "Keegan", "Kingston", "Kobe" +]; RefData.COUNTRY_CODES = { - Ireland: "ie", - Spain: "es", - "United Kingdom": "gb", - France: "fr", - Germany: "de", - Sweden: "se", - Italy: "it", - Greece: "gr", - Iceland: "is", - Portugal: "pt", - Malta: "mt", - Norway: "no", - Brazil: "br", - Argentina: "ar", - Colombia: "co", - Peru: "pe", - Venezuela: "ve", - Uruguay: "uy" - }; + Ireland: "ie", + Spain: "es", + "United Kingdom": "gb", + France: "fr", + Germany: "de", + Sweden: "se", + Italy: "it", + Greece: "gr", + Iceland: "is", + Portugal: "pt", + Malta: "mt", + Norway: "no", + Brazil: "br", + Argentina: "ar", + Colombia: "co", + Peru: "pe", + Venezuela: "ve", + Uruguay: "uy" +}; RefData.COUNTRIES = [ - {country: "Ireland", continent: "Europe", language: "English"}, - {country: "Spain", continent: "Europe", language: "Spanish"}, - {country: "United Kingdom", continent: "Europe", language: "English"}, - {country: "France", continent: "Europe", language: "French"}, - {country: "Germany", continent: "Europe", language: "(other)"}, - {country: "Sweden", continent: "Europe", language: "(other)"}, - {country: "Norway", continent: "Europe", language: "(other)"}, - {country: "Italy", continent: "Europe", language: "(other)"}, - {country: "Greece", continent: "Europe", language: "(other)"}, - {country: "Iceland", continent: "Europe", language: "(other)"}, - {country: "Portugal", continent: "Europe", language: "Portuguese"}, - {country: "Malta", continent: "Europe", language: "(other)"}, - {country: "Brazil", continent: "South America", language: "Portuguese"}, - {country: "Argentina", continent: "South America", language: "Spanish"}, - {country: "Colombia", continent: "South America", language: "Spanish"}, - {country: "Peru", continent: "South America", language: "Spanish"}, - {country: "Venezuela", continent: "South America", language: "Spanish"}, - {country: "Uruguay", continent: "South America", language: "Spanish"} - ]; + {country: "Ireland", continent: "Europe", language: "English"}, + {country: "Spain", continent: "Europe", language: "Spanish"}, + {country: "United Kingdom", continent: "Europe", language: "English"}, + {country: "France", continent: "Europe", language: "French"}, + {country: "Germany", continent: "Europe", language: "(other)"}, + {country: "Sweden", continent: "Europe", language: "(other)"}, + {country: "Norway", continent: "Europe", language: "(other)"}, + {country: "Italy", continent: "Europe", language: "(other)"}, + {country: "Greece", continent: "Europe", language: "(other)"}, + {country: "Iceland", continent: "Europe", language: "(other)"}, + {country: "Portugal", continent: "Europe", language: "Portuguese"}, + {country: "Malta", continent: "Europe", language: "(other)"}, + {country: "Brazil", continent: "South America", language: "Portuguese"}, + {country: "Argentina", continent: "South America", language: "Spanish"}, + {country: "Colombia", continent: "South America", language: "Spanish"}, + {country: "Peru", continent: "South America", language: "Spanish"}, + {country: "Venezuela", continent: "South America", language: "Spanish"}, + {country: "Uruguay", continent: "South America", language: "Spanish"} +]; RefData.DOB = [ - new Date(2000, 0, 1 ), - new Date(2001, 1, 2 ), - new Date(2002, 2, 3 ), - new Date(2003, 3, 4 ), - new Date(2004, 4, 5 ), - new Date(2005, 5, 6 ), - new Date(2006, 6, 7 ), - new Date(2007, 7, 8 ), - new Date(2008, 8, 9 ), - new Date(2009, 9, 10 ), - new Date(2010, 10, 11 ), - new Date(2011, 11, 12 ) + new Date(2000, 0, 1), + new Date(2001, 1, 2), + new Date(2002, 2, 3), + new Date(2003, 3, 4), + new Date(2004, 4, 5), + new Date(2005, 5, 6), + new Date(2006, 6, 7), + new Date(2007, 7, 8), + new Date(2008, 8, 9), + new Date(2009, 9, 10), + new Date(2010, 10, 11), + new Date(2011, 11, 12) ]; RefData.ADDRESSES = [ - '1197 Thunder Wagon Common, Cataract, RI, 02987-1016, US, (401) 747-0763', - '3685 Rocky Glade, Showtucket, NU, X1E-9I0, CA, (867) 371-4215', - '3235 High Forest, Glen Campbell, MS, 39035-6845, US, (601) 638-8186', - '2234 Sleepy Pony Mall , Drain, DC, 20078-4243, US, (202) 948-3634', - '2722 Hazy Turnabout, Burnt Cabins, NY, 14120-5642, US, (917) 604-6597', - '6686 Lazy Ledge, Two Rock, CA, 92639-3020, US, (619) 901-9911', - '2000 Dewy Limits, Wacahoota, NF, A4L-2V9, CA, (709) 065-3959', - '7710 Noble Pond Avenue, Bolivia, RI, 02931-1842, US, (401) 865-2160', - '3452 Sunny Vale, Pyro, ON, M8V-4Z0, CA, (519) 072-8609', - '4402 Dusty Cove, Many Farms, UT, 84853-8223, US, (435) 518-0673', - '5198 Silent Parade, Round Bottom, MD, 21542-9798, US, (301) 060-7245', - '8550 Shady Moor, Kitty Fork, CO, 80941-6207, US, (303) 502-3767', - '2131 Old Dell, Merry Midnight, AK, 99906-8842, US, (907) 369-2206', - '7390 Harvest Crest, Mosquito Crossing, RI, 02957-6116, US, (401) 463-6348', - '874 Little Point, Hot Coffee, BC, V3U-2P6, CA, (250) 706-9207', - '8834 Stony Pioneer Heights, Newlove, OR, 97419-8670, US, (541) 408-2213', - '9829 Grand Beach, Flint, UT, 84965-9900, US, (435) 700-5161', - '3799 Cozy Blossom Ramp, Ptarmigan, MS, 38715-0313, US, (769) 740-1526', - '3254 Silver Island Loop, Maunaloa, DE, 19869-3169, US, (302) 667-7671', - '1081 Middle Wood, Taylors Gut Landing, OR, 97266-2873, US, (541) 357-6310', - '1137 Umber Trail, Shacktown, NW, X3U-5Y8, CA, (867) 702-6883', - '9914 Hidden Bank, Wyoming, MO, 64635-9665, US, (636) 280-4192', - '7080 Misty Nectar Townline, Coward, AB, T9U-3N4, CA, (403) 623-2838', - '1184 Wishing Grounds, Vibank, NW, X7D-0V9, CA, (867) 531-2730', - '126 Easy Pointe, Grandview Beach, KY, 40928-9539, US, (502) 548-0956', - '6683 Colonial Street, Swan River, BC, V1A-9I8, CA, (778) 014-4257', - '960 Gentle Oak Lane, Shakopee, ND, 58618-6277, US, (701) 327-1219', - '6918 Cotton Pine Corner, Kenaston, IA, 52165-3975, US, (515) 906-7427', - '2368 Burning Woods, Ernfold, NY, 11879-9186, US, (646) 819-0355', - '5646 Quiet Shadow Chase, Tiger Tail, IA, 52283-5537, US, (712) 375-9225', - '5466 Foggy Mountain Dale, Sweet Home, MT, 59738-0251, US, (406) 881-1706', - '5313 Clear Willow Route, Amazon, BC, V0S-2S6, CA, (604) 340-7596', - '7000 Pleasant Autoroute, Spaceport City, UT, 84749-2448, US, (435) 154-3360', - '8359 Quaking Anchor Road, Gross, BC, V9O-0H5, CA, (250) 985-3859', - '5143 Amber Deer Hollow, New Deal, ND, 58446-0853, US, (701) 927-0322', - '6230 Jagged Bear Key, Young, AR, 72337-3811, US, (501) 805-7239', - '7207 Heather Vista, Devon, WY, 82520-1771, US, (307) 358-7092', - '9416 Red Rise Place, Spraytown, OK, 73809-4766, US, (580) 867-1973', - '3770 Golden Horse Diversion, Yelland, IL, 60471-1487, US, (224) 717-9349', - '4819 Honey Treasure Park, Alaska, NB, E1U-3I0, CA, (506) 656-9138', - '6187 Round Front, Land O Lakes, AK, 99873-6403, US, (907) 853-9063', - '9218 Crystal Highway, Pickelville, MT, 59847-9299, US, (406) 076-0024', - '6737 Bright Quay, Lazy Mountain, KY, 42390-4772, US, (606) 256-7288', - '237 Merry Campus, Twentysix, SC, 29330-4909, US, (864) 945-0157', - '446 Fallen Gate Rise, Petrolia, SC, 29959-9527, US, (864) 826-0553', - '2347 Indian Boulevard, Frisbee, VA, 23797-6458, US, (703) 656-8445', - '365 Emerald Grove Line, Level, NC, 28381-1514, US, (919) 976-7958', - '1207 Iron Extension, Klickitat, SC, 29197-8571, US, (803) 535-7888', - '6770 Cinder Glen, Caronport, OH, 45053-5002, US, (440) 369-4018', - '7619 Tawny Carrefour, Senlac, NV, 89529-9876, US, (775) 901-6433']; + '1197 Thunder Wagon Common, Cataract, RI, 02987-1016, US, (401) 747-0763', + '3685 Rocky Glade, Showtucket, NU, X1E-9I0, CA, (867) 371-4215', + '3235 High Forest, Glen Campbell, MS, 39035-6845, US, (601) 638-8186', + '2234 Sleepy Pony Mall , Drain, DC, 20078-4243, US, (202) 948-3634', + '2722 Hazy Turnabout, Burnt Cabins, NY, 14120-5642, US, (917) 604-6597', + '6686 Lazy Ledge, Two Rock, CA, 92639-3020, US, (619) 901-9911', + '2000 Dewy Limits, Wacahoota, NF, A4L-2V9, CA, (709) 065-3959', + '7710 Noble Pond Avenue, Bolivia, RI, 02931-1842, US, (401) 865-2160', + '3452 Sunny Vale, Pyro, ON, M8V-4Z0, CA, (519) 072-8609', + '4402 Dusty Cove, Many Farms, UT, 84853-8223, US, (435) 518-0673', + '5198 Silent Parade, Round Bottom, MD, 21542-9798, US, (301) 060-7245', + '8550 Shady Moor, Kitty Fork, CO, 80941-6207, US, (303) 502-3767', + '2131 Old Dell, Merry Midnight, AK, 99906-8842, US, (907) 369-2206', + '7390 Harvest Crest, Mosquito Crossing, RI, 02957-6116, US, (401) 463-6348', + '874 Little Point, Hot Coffee, BC, V3U-2P6, CA, (250) 706-9207', + '8834 Stony Pioneer Heights, Newlove, OR, 97419-8670, US, (541) 408-2213', + '9829 Grand Beach, Flint, UT, 84965-9900, US, (435) 700-5161', + '3799 Cozy Blossom Ramp, Ptarmigan, MS, 38715-0313, US, (769) 740-1526', + '3254 Silver Island Loop, Maunaloa, DE, 19869-3169, US, (302) 667-7671', + '1081 Middle Wood, Taylors Gut Landing, OR, 97266-2873, US, (541) 357-6310', + '1137 Umber Trail, Shacktown, NW, X3U-5Y8, CA, (867) 702-6883', + '9914 Hidden Bank, Wyoming, MO, 64635-9665, US, (636) 280-4192', + '7080 Misty Nectar Townline, Coward, AB, T9U-3N4, CA, (403) 623-2838', + '1184 Wishing Grounds, Vibank, NW, X7D-0V9, CA, (867) 531-2730', + '126 Easy Pointe, Grandview Beach, KY, 40928-9539, US, (502) 548-0956', + '6683 Colonial Street, Swan River, BC, V1A-9I8, CA, (778) 014-4257', + '960 Gentle Oak Lane, Shakopee, ND, 58618-6277, US, (701) 327-1219', + '6918 Cotton Pine Corner, Kenaston, IA, 52165-3975, US, (515) 906-7427', + '2368 Burning Woods, Ernfold, NY, 11879-9186, US, (646) 819-0355', + '5646 Quiet Shadow Chase, Tiger Tail, IA, 52283-5537, US, (712) 375-9225', + '5466 Foggy Mountain Dale, Sweet Home, MT, 59738-0251, US, (406) 881-1706', + '5313 Clear Willow Route, Amazon, BC, V0S-2S6, CA, (604) 340-7596', + '7000 Pleasant Autoroute, Spaceport City, UT, 84749-2448, US, (435) 154-3360', + '8359 Quaking Anchor Road, Gross, BC, V9O-0H5, CA, (250) 985-3859', + '5143 Amber Deer Hollow, New Deal, ND, 58446-0853, US, (701) 927-0322', + '6230 Jagged Bear Key, Young, AR, 72337-3811, US, (501) 805-7239', + '7207 Heather Vista, Devon, WY, 82520-1771, US, (307) 358-7092', + '9416 Red Rise Place, Spraytown, OK, 73809-4766, US, (580) 867-1973', + '3770 Golden Horse Diversion, Yelland, IL, 60471-1487, US, (224) 717-9349', + '4819 Honey Treasure Park, Alaska, NB, E1U-3I0, CA, (506) 656-9138', + '6187 Round Front, Land O Lakes, AK, 99873-6403, US, (907) 853-9063', + '9218 Crystal Highway, Pickelville, MT, 59847-9299, US, (406) 076-0024', + '6737 Bright Quay, Lazy Mountain, KY, 42390-4772, US, (606) 256-7288', + '237 Merry Campus, Twentysix, SC, 29330-4909, US, (864) 945-0157', + '446 Fallen Gate Rise, Petrolia, SC, 29959-9527, US, (864) 826-0553', + '2347 Indian Boulevard, Frisbee, VA, 23797-6458, US, (703) 656-8445', + '365 Emerald Grove Line, Level, NC, 28381-1514, US, (919) 976-7958', + '1207 Iron Extension, Klickitat, SC, 29197-8571, US, (803) 535-7888', + '6770 Cinder Glen, Caronport, OH, 45053-5002, US, (440) 369-4018', + '7619 Tawny Carrefour, Senlac, NV, 89529-9876, US, (775) 901-6433']; RefData.IT_SKILLS = ['android', 'css', 'html5', 'mac', 'windows']; diff --git a/src/richGridExample/RichGridExample.jsx b/src/richGridExample/RichGridExample.jsx index 3f2660a..d11a214 100644 --- a/src/richGridExample/RichGridExample.jsx +++ b/src/richGridExample/RichGridExample.jsx @@ -140,10 +140,11 @@ export default class RichGridExample extends Component {
-
+
diff --git a/src/richGridExample/RowDataFactory.js b/src/richGridExample/RowDataFactory.js index 0c68143..27ff58e 100644 --- a/src/richGridExample/RowDataFactory.js +++ b/src/richGridExample/RowDataFactory.js @@ -3,10 +3,10 @@ import RefData from './RefData'; export default class RowDataFactory { createRowData() { - var rowData = []; + const rowData = []; - for (var i = 0; i < 200; i++) { - var countryData = RefData.COUNTRIES[i % RefData.COUNTRIES.length]; + for (let i = 0; i < 200; i++) { + const countryData = RefData.COUNTRIES[i % RefData.COUNTRIES.length]; rowData.push({ name: RefData.FIRST_NAMES[i % RefData.FIRST_NAMES.length] + ' ' + RefData.LAST_NAMES[i % RefData.LAST_NAMES.length], skills: { @@ -32,8 +32,8 @@ export default class RowDataFactory { } createRandomPhoneNumber() { - var result = '+'; - for (var i = 0; i < 12; i++) { + let result = '+'; + for (let i = 0; i < 12; i++) { result += Math.round(Math.random() * 10); if (i === 2 || i === 5 || i === 8) { result += ' '; diff --git a/src/richGridExample/SkillsCellRenderer.jsx b/src/richGridExample/SkillsCellRenderer.jsx index 90820d4..7c22d51 100644 --- a/src/richGridExample/SkillsCellRenderer.jsx +++ b/src/richGridExample/SkillsCellRenderer.jsx @@ -5,11 +5,11 @@ import RefData from './RefData'; export default class SkillsCellRenderer extends React.Component { render() { - var skills = []; - var rowData = this.props.data; - RefData.IT_SKILLS.forEach( (skill) => { + const skills = []; + const rowData = this.props.data; + RefData.IT_SKILLS.forEach((skill) => { if (rowData && rowData.skills && rowData.skills[skill]) { - skills.push(); + skills.push(); } }); diff --git a/src/richGridExample/SkillsFilter.jsx b/src/richGridExample/SkillsFilter.jsx index d61eb14..cb44c89 100644 --- a/src/richGridExample/SkillsFilter.jsx +++ b/src/richGridExample/SkillsFilter.jsx @@ -42,8 +42,8 @@ export default class SkillsFilter extends React.Component { // called by agGrid doesFilterPass(params) { - var rowSkills = params.data.skills; - var passed = true; + const rowSkills = params.data.skills; + let passed = true; RefData.IT_SKILLS.forEach((skill) => { if (this.state[skill]) { @@ -62,14 +62,14 @@ export default class SkillsFilter extends React.Component { // called by agGrid isFilterActive() { - var somethingSelected = this.state.android || this.state.css || + const somethingSelected = this.state.android || this.state.css || this.state.html5 || this.state.mac || this.state.windows; return somethingSelected; }; onSkillChanged(skill, event) { - var newValue = event.target.checked; - var newModel = {}; + const newValue = event.target.checked; + const newModel = {}; newModel[skill] = newValue; // set the state, and once it is done, then call filterChangedCallback this.setState(newModel, this.props.filterChangedCallback); @@ -81,11 +81,11 @@ export default class SkillsFilter extends React.Component { render() { - var skillsTemplates = []; + const skillsTemplates = []; RefData.IT_SKILLS.forEach((skill, index) => { - var skillName = RefData.IT_SKILLS_NAMES[index]; - var template = ( + const skillName = RefData.IT_SKILLS_NAMES[index]; + const template = (