score:1

Accepted answer

for now, it seems that the only possible way and place to implement this is to use the ongridready event, and there it is possible to set values for calculated rows (via rownode.setdatavalue()). the grid has all data (+ aggregated data) at this stage. this link is useful to understand how to collect all data.

the better way is to define getrownodeid callback

getrownodeid: row => {
   // custom rownodeid resolver
},

and get values by data column and rowid (jan, feb, etc.).

here is a simple implementation:

  ongridready: ({ api }) => {
    const income = api.getrownode('row-group-0');
    const in1row = api.getrownode('incomein 1');
    const in2row = api.getrownode('incomein 2');
    const liabilities = api.getrownode('liabilities');
    
    api.foreachnode(rownode => console.log(rownode.id));

    for (const col of ["jan", "feb"]) {
      const netincome = api.getvalue(col, in1row) + api.getvalue(col, in2row) - api.getvalue(col, liabilities);
      const netincometotal = api.getvalue(col, income) - api.getvalue(col, liabilities);

      const netincomerow = api.getrownode('net income');
      netincomerow.setdatavalue(col, netincome);

      const netincometotalrow = api.getrownode('net income total');
      netincometotalrow.setdatavalue(col, netincometotal);
    }
  }

reference to plunker here.

score:1

have you looked at calculated columns in adaptable which we use in conjunction with ag grid.

it gives you exactly what you want: https://docs.adaptabletools.com/guide/handbook-calculated-column


Related Query

More Query from same tag