Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc2a8d959c | ||
|
|
3fb8e85645 | ||
|
|
46aeeb228a | ||
|
|
44c06b41e3 | ||
|
|
f984c4175b | ||
|
|
d94d79c1b1 | ||
|
|
cd7c199f4d | ||
|
|
49fca88d58 | ||
|
|
a22d3da8ce |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ag-grid-react-example",
|
"name": "ag-grid-react-example",
|
||||||
"version": "4.1.0",
|
"version": "5.2.0",
|
||||||
"description": "Example Reach applicaiton using ag-Grid.",
|
"description": "Example Reach applicaiton using ag-Grid.",
|
||||||
"main": "dist/ag-grid-react-example.js",
|
"main": "dist/ag-grid-react-example.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "0.14.6",
|
"react": "0.14.6",
|
||||||
"react-dom": "0.14.6",
|
"react-dom": "0.14.6",
|
||||||
"ag-grid": "4.1.x",
|
"ag-grid": "~5.2.0",
|
||||||
"ag-grid-enterprise": "4.1.x",
|
"ag-grid-enterprise": "~5.2.0",
|
||||||
"ag-grid-react": "4.1.x"
|
"ag-grid-react": "~5.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export default class ColDefFactory {
|
|||||||
{
|
{
|
||||||
headerName: 'Employee',
|
headerName: 'Employee',
|
||||||
children: [
|
children: [
|
||||||
{headerName: "Name", field: "name",
|
{headerName: "Name", field: "name", enableRowGroup: true, enablePivot: true,
|
||||||
width: 150, pinned: true},
|
width: 150, pinned: true},
|
||||||
{headerName: "Country", field: "country", width: 150,
|
{headerName: "Country", field: "country", width: 150, enableRowGroup: true, enablePivot: true,
|
||||||
// not bothering with React for country, as it's a simple HTML string
|
// not bothering with React for country, as it's a simple HTML string
|
||||||
cellRenderer: countryCellRenderer, pinned: true,
|
cellRenderer: countryCellRenderer, pinned: true,
|
||||||
filterParams: {cellRenderer: countryCellRenderer, cellHeight: 20}},
|
filterParams: {cellRenderer: countryCellRenderer, cellHeight: 20}},
|
||||||
@@ -27,13 +27,13 @@ export default class ColDefFactory {
|
|||||||
{
|
{
|
||||||
headerName: 'IT Skills',
|
headerName: 'IT Skills',
|
||||||
children: [
|
children: [
|
||||||
{headerName: "Skills", width: 125, suppressSorting: true, field: 'skills',
|
{headerName: "Skills", width: 125, suppressSorting: true, field: 'skills', enableRowGroup: true, enablePivot: true,
|
||||||
// using ag-Grid's React cellRenderer factory
|
// using ag-Grid's React cellRenderer factory
|
||||||
cellRenderer: reactCellRendererFactory(SkillsCellRenderer),
|
cellRenderer: reactCellRendererFactory(SkillsCellRenderer),
|
||||||
// using ag-Grid's React filter factory
|
// using ag-Grid's React filter factory
|
||||||
filter: reactFilterFactory(SkillsFilter)
|
filter: reactFilterFactory(SkillsFilter)
|
||||||
},
|
},
|
||||||
{headerName: "Proficiency", field: "proficiency", filter: 'number', width: 120,
|
{headerName: "Proficiency", field: "proficiency", filter: 'number', width: 120, enableValue: true,
|
||||||
// using ag-Grid's React cellRenderer factory
|
// using ag-Grid's React cellRenderer factory
|
||||||
cellRenderer: reactCellRendererFactory(ProficiencyCellRenderer),
|
cellRenderer: reactCellRendererFactory(ProficiencyCellRenderer),
|
||||||
// using ag-Grid's React filter factory
|
// using ag-Grid's React filter factory
|
||||||
@@ -56,8 +56,12 @@ export default class ColDefFactory {
|
|||||||
// this is a simple cell renderer, putting together static html, no
|
// this is a simple cell renderer, putting together static html, no
|
||||||
// need to use React for it.
|
// need to use React for it.
|
||||||
function countryCellRenderer(params) {
|
function countryCellRenderer(params) {
|
||||||
var flag = "<img border='0' width='15' height='10' " +
|
if (params.value) {
|
||||||
"style='margin-bottom: 2px' src='http://flags.fmcdn.net/data/flags/mini/"
|
var flag = "<img border='0' width='15' height='10' " +
|
||||||
+ RefData.COUNTRY_CODES[params.value] + ".png'>";
|
"style='margin-bottom: 2px' src='http://flags.fmcdn.net/data/flags/mini/"
|
||||||
return flag + " " + params.value;
|
+ RefData.COUNTRY_CODES[params.value] + ".png'>";
|
||||||
|
return flag + " " + params.value;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export default class SkillsCellRenderer extends React.Component {
|
|||||||
var skills = [];
|
var skills = [];
|
||||||
var rowData = this.props.params.data;
|
var rowData = this.props.params.data;
|
||||||
RefData.IT_SKILLS.forEach( (skill) => {
|
RefData.IT_SKILLS.forEach( (skill) => {
|
||||||
if (rowData.skills[skill]) {
|
if (rowData && rowData.skills && rowData.skills[skill]) {
|
||||||
skills.push(<img key={skill} src={'images/skills/' + skill + '.png'} width={16} title={skill} />);
|
skills.push(<img key={skill} src={'images/skills/' + skill + '.png'} width={16} title={skill} />);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MyApp from './MyApp.jsx';
|
import MyApp from './myApp.jsx';
|
||||||
// is there a better way of doing this?
|
// is there a better way of doing this?
|
||||||
import 'ag-grid-root/dist/styles/ag-grid.css';
|
import 'ag-grid-root/dist/styles/ag-grid.css';
|
||||||
import 'ag-grid-root/dist/styles/theme-fresh.css';
|
import 'ag-grid-root/dist/styles/theme-fresh.css';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {AgGridReact} from 'ag-grid-react';
|
|||||||
import RefData from './RefData';
|
import RefData from './RefData';
|
||||||
import RowDataFactory from './RowDataFactory';
|
import RowDataFactory from './RowDataFactory';
|
||||||
import ColDefFactory from './ColDefFactory.jsx';
|
import ColDefFactory from './ColDefFactory.jsx';
|
||||||
import './MyApp.css';
|
import './myApp.css';
|
||||||
|
|
||||||
// take this line out if you do not want to use ag-Grid-Enterprise
|
// take this line out if you do not want to use ag-Grid-Enterprise
|
||||||
import 'ag-grid-enterprise';
|
import 'ag-grid-enterprise';
|
||||||
|
|||||||
Reference in New Issue
Block a user