ag-grid Angular“不赞成使用colDef.cellRendererFramework.component”组件。 [英] ag-grid Angular "colDef.cellRendererFramework.component is deprecated"

查看:188
本文介绍了ag-grid Angular“不赞成使用colDef.cellRendererFramework.component”组件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于先前版本的ag-grid,我们可以像下面这样将Component作为依赖项传递到我们的cellRendererFramework中:

Since previous version of ag-grid we could pass a Component as a dependency into our cellRendererFramework like this:

{
    headerName: "Clickable Component",
    field: "name",
    cellRendererFramework: {
        component: ClickableParentComponent,
        dependencies: [ClickableComponent]
    },
    width: 200
}

这是从 ag-grid博客

不幸的是,第9版给了我关于此的过时警告:

Unfortunatelly version 9 gives me a deprecated warning about this:

colDef.cellRendererFramework.component is deprecated - please refer to https://ag-grid.com/best-angular-2-data-grid/

现在有什么推荐的方法可以做到这一点吗?我在ag-grid的变更日志中找不到任何相关信息。

Is there any recommended way now to achieve this? I couldn't find anything about this in ag-grid's changelogs.

推荐答案

对,与父组件通信的诀窍是使用上下文对象:

Right, the trick to communicate with the parent component is using the context object:

this.gridOptions = <GridOptions>{
    context: {
        componentParent: this
    }
};

来自简单的动态组件示例

这篇关于ag-grid Angular“不赞成使用colDef.cellRendererFramework.component”组件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆