ag-grid 将 cellRendererParams 设置为来自行数据的值 [英] ag-grid set cellRendererParams to values from the row data

查看:22
本文介绍了ag-grid 将 cellRendererParams 设置为来自行数据的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 cellRendererParams 对象将数据发送到我的 cellRenderer 组件,但我不知道如何为此访问行数据.这是我想要做的一个例子:

I want to send data to my cellRenderer component via the cellRendererParams object but I don't know how to access row data for this. Here's an example of what I want to do:

cellRendererParams: {
    label: currentRowData.myField + currentRowData.myOtherField
}

我不希望我的 cellRenderer 组件知道网格的数据结构,因为我可能会在其他具有不同行数据的网格中使用它.

I don't want my cellRenderer component to have knowledge of the data structure of the grid since I may use it in other grids with different row data.

推荐答案

有很多方法:

1)

valueGetter: (params) => ({ property1: params.data.myField1 + params.data.myField2, property2: params.data.someOtherField }),

valueFormatter: ({ property1: params.data.myField1 + params.data.myField2, property2: params.data.someOtherField }),

这篇关于ag-grid 将 cellRendererParams 设置为来自行数据的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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