Ag-grid-react cellRendererFramework не работает - PullRequest
0 голосов
/ 18 июня 2020

Я пытаюсь поместить ссылку из response-router-dom в ag-grid-react, но cellRenderedFramework пока ничего не отображает, остальные столбцы отображаются нормально

Вот columnDefs,

columnDefs = [
        {
            headerName: "Id",
            field: "id",
            resizable: true,
            cellClass: 'lock-pinned',
            filter: 'agNumberColumnFilter',
            hide: true
        },
        {
            field: "Actions",
            maxWidth: 112,
            cellRenderer: 'linkDetail',
            pinned: 'right',
            cellClass: 'lock-pinned'
        }];

Вот gridOptions,

gridOptions = {
        columnDefs: this.columnDefs,
        rowData: rowData,
        reactNext: true,
        rowHeight: 40,
        floatingFilter: true,
        onGridReady: (params) => {
            params.api.sizeColumnsToFit();
            this.gridApi = params.columnApi;
        },
        pagination: true,
        paginationAutoPageSize: true,
        frameworkComponents: {
            linkDetail: LinkDetail
        }
    };

И компонент LinkDetails,

export default class LinkDetail implements ICellRendererReactComp {
    props: any;

    constructor(props) {
        this.props = props;
    }
    refresh(params: any): boolean {
        throw new Error("Method not implemented.");
    }
    afterGuiAttached?(params?: IAfterGuiAttachedParams): void {
        throw new Error("Method not implemented.");
    }

    render() {
        return (<span><Link to={`database_detail_page/${this.props.data.id}`}><img src={ver_icono} alt='see' className='icons-table' /></Link></span>);
    }
}

И в консоли веб-страницы он возвращает

Uncaught TypeError: Cannot read property 'isCellRenderer' of null
    at ReactComponent.renderStaticMarkup (reactComponent.js:138)
    at ReactComponent.init (reactComponent.js:50)
    at UserComponentFactory.initComponent (ag-grid-community.cjs.js:12996)
    at UserComponentFactory.createAndInitUserComponent (ag-grid-community.cjs.js:12743)
    at UserComponentFactory.newCellRenderer (ag-grid-community.cjs.js:12673)
    at createCellRendererFunc (ag-grid-community.cjs.js:17207)
    at AnimationFrameService.executeFrame (ag-grid-community.cjs.js:31395)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...