Trying to access all data rendered in Ag-Grid - including the value of calculated columns which use value getters . I have only been able to access the data provided to Ag-Grid, but not any calculated columns (see code below).
var items = [];
var cnt = gridOptions.api.getDisplayedRowCount();
for (var i = 0; i < cnt; i++) {
var rowNode = gridOptions.api.getDisplayedRowAtIndex(i);
items.push(rowNode.data);
}
Any suggestions would be greatly appreciated. I'm trying to save the output of the calculated columns to a database.
Thought of a workaround - write to the data within the valueGetter function. This way the data stores the calculated values and can then be exported using the built-in api functions (such as using forEachNode).
valueGetter: function (params){
//your normal value getter logic here
var output = params.data['column1'] + params.data['column2']
//write to the data
var col = params.colDef.field;
params.data[col] = output;
return output;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.