I have used using this trying to fit the column and row width how to dynamically set the row height and column width in ag-grid(please provide git hub code in typescript)
Asked
Active
Viewed 1,427 times
2 Answers
0
I am assuming that you want to set row height based on the content of a row.
step 1 : set getRowHeight property to a javascript function.
gridOptions.getRowHeight = rowHeightFn
step 2 : define rowHeightFn based on your requirement.
function rowHeightFn(params) {
var result = 46;
if (params.data.someKey === 2) {
result = 2;
}
return result
}

Pradeep Singh
- 1
- 1
0
It is possible to set the row height based on the contents of the cells. To do this, set autoHeight=true on each column where height should be calculated from. For example, if one column is showing description text over multiple lines, then you may choose to select only that column to determine the line height.
https://ag-grid.com/javascript-data-grid/row-height/#auto-row-height
{
field: 'autoA',
width: 300,
wrapText: true,
autoHeight: true,
headerName: 'A) Auto Height',
},
See the following code example: https://plnkr.co/edit/riWmCw1IgR7vBixB?open=main.ts

Stephen Cooper
- 1,069
- 7
- 15