new component model
This commit is contained in:
@@ -48,15 +48,11 @@ export default class MyApp extends React.Component {
|
|||||||
createColumnDefs() {
|
createColumnDefs() {
|
||||||
var columnDefs = [];
|
var columnDefs = [];
|
||||||
|
|
||||||
// pass in the parent component to use for React component to the cellRenderer.
|
|
||||||
// this is optional. if missing, then react router will not work.
|
|
||||||
var cellRenderer = reactCellRendererFactory(SimpleCellRenderer, this);
|
|
||||||
|
|
||||||
this.columnNames.forEach( colName => {
|
this.columnNames.forEach( colName => {
|
||||||
columnDefs.push({
|
columnDefs.push({
|
||||||
headerName: colName.toUpperCase(),
|
headerName: colName.toUpperCase(),
|
||||||
field: colName,
|
field: colName,
|
||||||
cellRenderer: cellRenderer,
|
cellRendererFramework: SimpleCellRenderer,
|
||||||
width: 100
|
width: 100
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ import React from 'react';
|
|||||||
|
|
||||||
export default class SimpleCellRenderer extends React.Component {
|
export default class SimpleCellRenderer extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
var params = this.props.params;
|
|
||||||
|
|
||||||
// the class below does nothing, it's just for testing, so we can inspect the dom of
|
// the class below does nothing, it's just for testing, so we can inspect the dom of
|
||||||
// the result and looking for it, to validate that this cellRenderer is actually getting used.
|
// the result and looking for it, to validate that this cellRenderer is actually getting used.
|
||||||
return (
|
return (
|
||||||
<span className="simple-cell-renderer">{params.value}</span>
|
<span className="simple-cell-renderer">{this.props.value}</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user