0

There is an Ag-Grid table component. It has a column with text in each cell. Text is longer than cell's width. Cell should be multiline and it's height should fit text on changing of width. I found how to make cell multiline here I found how to update cell height on width change here

So I think that method getRowHeight() which is called on each manual moving of the column's border, - could help. The question is - how to calculate it's height so that it fit the size of the multiline text in the cell? It seems that there should be a function where height of the cell depends of the length of the text string in the cell and current width? Or maybe is there a better way to dynamically change height of a multiline cell with text (and row) on it's changed width?)

hyWhy
  • 23
  • 5

1 Answers1

0

As of a few versions ago, ag-grid supports out of the box auto row-height

https://www.ag-grid.com/javascript-grid-row-height/#auto-row-height

Have a look here, all you need to do is enable it.

Alberto Gutierrez
  • 1,588
  • 7
  • 9
  • I see, there's an autoHeight:true property, which makes ag-grid to fit to columns, but it has a big flaw: it doesnt use all space of the line. – hyWhy Oct 18 '18 at 10:14
  • It creates second line long before the end of the first line - and cell which could easily show text using only one line, somehow takes two lines. I didn't find how to change settings of autoresizing and that's why I am trying to do this manually with method getRowHeight() – hyWhy Oct 18 '18 at 10:18