ag-grid set cellRendererParams to values from the row data

£可爱£侵袭症+ 提交于 2020-12-15 05:45:06

问题


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
}

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:


there are many ways:

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 }),



回答2:


Try using a valueGetter, like this:

valueGetter: (params) => params.data.myField + params.data.myOtherField


来源:https://stackoverflow.com/questions/65097384/ag-grid-set-cellrendererparams-to-values-from-the-row-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!