I am using ag-grid v21 & Angular 6, with a server side row model. I want to automatically resize the column widths, but the behaviour is not quite what I expect.
As I am getting data asynchronously, I do a gridColumnApi.autoSizeColumns(...) when I get the data in onGridReady() (I also tried doing this in onFirstDataRendered(), but it had the same behaviour).
This renders the data like this, truncating the values (screenshot 1):
If I trigger the column resize manually by double clicking the vertical column separator, like in Excel, the column is resized to what I want (screenshot 2):
My question is: how can I achieve the behaviour from screenshot 2 automatically?
(Is this a timing problem, i.e. when I manually resize by double clicking, the grid has more information than upon the initial rendering and that's why the column is resized correctly?)
EDIT: Seems to be a timing issue. I am now resizing in onGridSizeChanged(), and sometimes (when onGridReady() takes longer (?), and onGridSizeChanged() is called after onGridReady()), it resizes correctly.
EDIT2: Solved, sort of. It is a specific aspect of my use case that causes the ambiguous timing, see comments below.

