AGGRID auto-size columns to data width

Sorry for yet another aggrid question!

I'm trying to get an aggrid to size to my data. I'm ok with the table implementing a horizontal scroll bar to resize the data to where I can see it.

Currently, each column is the same exact size. So if I have many columns it smushes them into equal spacing. When I render my data I don't know the max/min size of each column.

​

I've tried calling the aggrid api methods to invoke their auto-sizing but it doesn't seem to work:
I've tried this:
table.on('firstDataRendered', table.call_api_method('autoSizeColumns'))

and also this:

table.call_api_method('sizeColumnsToFit')

Neither seem to work. Any thoughts?

Posted Oct 20, 2023, 4:59 PM UTC

14
Loading comments…