ag-grid: frameworkComponents don't accept props

I’m submitting a … (check one with “x”)

[ x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid/blob/master/CONTRIBUTING.md#question

Current behavior

I cannot pass a React component to the GridOptions.frameworkComponents attribute. My component accepts props, while the data definition states that props cannot be accepted.

Expected behavior

My React component should be able to accept props in its constructor.

Minimal reproduction of the problem with instructions

        <AgGridReact
            onGridReady={this.on_grid_ready}
            rowSelection="multiple"
            rowData={this.props.get_rows()}
            enableColResize
            frameworkComponents={{
                derivative_cell_renderer: MyComponentWithProps
            }}
            gridOptions={{...this.gridOptions, columnDefs: this.props.get_columns()}}>

        </AgGridReact>

What is the motivation / use case for changing the behavior?

I would like to provide a custom Cell Renderer React Component

Please tell us about your environment:

Developing in Debian 8 virtualbox

  • ag-Grid version: X.X.X

17.0.0

  • Browser:

Chrome is the browser.

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Typescript.

THE FIX:

frameworkComponent definition looks like this: frameworkComponents?: { [p: string]: { new (): any; }; };

And I would like it to look like this: frameworkComponents?: { [p: string]: { new (): any; } | { new (props: any): any }; };

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 18 (4 by maintainers)

Most upvoted comments

Hi, @MaxMillington were you able to find the docs? I am using AG-Grid React and trying to pass props to a custom Framework component. Thanks

Update: I have tried to change \node_modules\ag-grid-community\dist\lib\entities\gridOptions.d.ts to frameworkComponents?: { [p: string]: { new (...args: any[]): any }; };

seems all works fine, compiled and service injected properly