AG-420 Improve React implementation

This commit is contained in:
Sean Landsman
2017-05-17 13:22:59 +01:00
parent 4069f6bc10
commit 8677118a27
16 changed files with 3807 additions and 18 deletions

View File

@@ -3,7 +3,7 @@
import ReactDOM from 'react-dom';
import React from 'react';
import MyApp from './myApp.jsx';
// is there a better way of doing this?
import 'ag-grid-root/dist/styles/ag-grid.css';
import 'ag-grid-root/dist/styles/theme-fresh.css';

View File

@@ -5,9 +5,8 @@ import ColDefFactory from "./ColDefFactory.jsx";
import MyReactDateComponent from "./MyReactDateComponent.jsx";
import MyReactHeaderComponent from "./MyReactHeaderComponent.jsx";
import "./myApp.css";
import "ag-grid-enterprise";
// take this line out if you do not want to use ag-Grid-Enterprise
import "ag-grid-enterprise";
export default class MyApp extends React.Component {
@@ -40,20 +39,24 @@ export default class MyApp extends React.Component {
// what you want!
this.gridOptions = {
//We register the react date component that ag-grid will use to render
dateComponentFramework:MyReactDateComponent,
dateComponentFramework: MyReactDateComponent,
// this is how you listen for events using gridOptions
onModelUpdated: function () {
console.log('event onModelUpdated received');
},
defaultColDef : {
headerComponentFramework : MyReactHeaderComponent,
headerComponentParams : {
defaultColDef: {
headerComponentFramework: MyReactHeaderComponent,
headerComponentParams: {
menuIcon: 'fa-bars'
}
},
// this is a simple property
rowBuffer: 10 // no need to set this, the default is fine for almost all scenarios
};
this.onGridReady = this.onGridReady.bind(this);
this.onRowSelected = this.onRowSelected.bind(this);
this.onCellClicked = this.onCellClicked.bind(this);
}
onShowGrid(show) {
@@ -108,7 +111,7 @@ export default class MyApp extends React.Component {
componentInstance.helloFromSkillsFilter();
}
dobFilter () {
dobFilter() {
let dateFilterComponent = this.gridOptions.api.getFilterInstance('dob');
dateFilterComponent.setFilterType('equals');
dateFilterComponent.setDateFrom('2000-01-01');
@@ -181,9 +184,9 @@ export default class MyApp extends React.Component {
gridOptions={this.gridOptions}
// listening for events
onGridReady={this.onGridReady.bind(this)}
onRowSelected={this.onRowSelected.bind(this)}
onCellClicked={this.onCellClicked.bind(this)}
onGridReady={this.onGridReady}
onRowSelected={this.onRowSelected}
onCellClicked={this.onCellClicked}
// binding to simple properties
showToolPanel={this.state.showToolPanel}