Ag Grid 企业功能

Ag Grid Enterprise features

我正在使用 ag-grid-enterprise

app.js

import React from 'react'
import ReactDOM from 'react-dom'
import { LicenseManager } from "ag-grid-enterprise"

LicenseManager.setLicenseKey('<enterprisekey>')
...

DataGrid.js

import { AgGridReact } from 'ag-grid-react'
import 'ag-grid-enterprise'
import React from 'react'

class DataGrid extends React.Component {


    onGridReady = params => {
     this.gridApi = params.api
     this.gridColumnApi = params.columnApi
     console.log('params', params) // ag-grid enterprise features are null E.G.(aggFuncService, clipboardService)
    }

    render() {

    return (
          // Props omitted for brevity
          <AgGridReact />
    )
  }

 }

package.json

{
"ag-grid": "18.1.1",
"ag-grid-community": "^19.1.1",
"ag-grid-enterprise": "^19.1.1",
"ag-grid-react": "18.1.0",
}

为什么 ag-grid-react enterprise 特征为空?看来我这里做错了。

首先: 删除 obsolete npm package ag-grid

Breaking Changes:

The NPM package name for the free module of ag-Grid is now ag-grid-community instead of ag-grid. This means you install with npm install ag-grid-community and then you reference like import {Grid, GridOptions} from "ag-grid-community".

然后: 将 ag-grid-react 更新为与 ag-grid-community

相同的版本

最后一个,不确定您要在 params 中找到什么,但如果您的许可证有效,您应该可以使用所有功能。

simple check: just add [enableRangeSelection]="true" in gridOptions and try to select range among rows+columns