You can set the row height to be static in the gridOptions
or via the property rowHeight={25}
the way you did.
However, agGrid also has a hardcoded value for the line-height that makes the rows only accept single line text.
changing the lineHeight
, to something you prefer is the way to go if you want to start changing the rowHeight
in addition to the fixed value.
Note: rowHeight
field values don't work at all if you are in the infiniteRow
model that is commonly used for server-side pagination because agGrid has problems calculating rowHeights
and gridHeights
if it doesn't know the full extent of the rows data.
if you want to change the lineHeight on all cells you can use the defaultColDef attribute cellClass
and pass a class that forces the lineHeight
EDIT: here is how I do it,
in the defaultColDef object :
defaultColDef: {
....
cellClass:'cell-wrap-text',
....
}
then define that class like this:
.cell-wrap-text{
white-space: normal !important;
line-height: 23px !important;
}
the whitespace line will make your text break and go back to line, since agGrid doesn't allow that by default.
after doing so, you can set the rowHeight
in the react component like you already did.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…