问题
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