How to access a cell value when the column has been defined with ag-grid value getters?


If the ag-grid column definition has been defined with a value getter , the value gets displayed fine on the grid. However I was not able to find a way to access a value in a given cell if the cell is using cell value getters. Was trying to access the data through api.forEachNode, but it doesnt show the data. The only way I found was to export the data as CSV and then parse it using getDataAsCsv(params).

Is exporting the data the only way to access value of a column in a grid with a value getter?

Thanks in advance:)


You can always add a new property to your data.

Let’s say I have a derived column to show the row index, where I am just returning row index.

Before returning from value getter, I can add this index to a new property called ‘special’

   headerName: 'Special',
   maxWidth: 100,
   valueGetter: function(params) { = params.node.rowIndex; // added property called special
    return params.node.rowIndex;

You can now access this in api.forEachNode by doing –

this.gridApi.forEachNode(function(rowNode, index) {

Answered By – Pratik Bhat

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published