Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ag-grid: Need to aggregate multiple fields into a table within a cell

Tags:

ag-grid

I'm wondering what the best practice is for displaying a table (with data from multiple fields) within a cell in ag-grid?

I think I can get it to work with formatting the entire table as an html string and passing that to the grid as the field and using a cellRenderer, however I'd rather not have that kind of view logic on the server-side.

I'd really like for the column definition to be able to take in more than one field, but it doesn't seem like that's possible.

Any ideas? Thanks.

like image 577
mstrom Avatar asked Dec 18 '22 22:12

mstrom


1 Answers

You can define a valueGetter for the desired column in column def. Here is a sample -

valueGetter: 
function sumField(params) {
          return params.data.a + params.data.b
}

Value getters example

like image 116
Pratik Bhat Avatar answered Dec 28 '22 07:12

Pratik Bhat