How to auto size column width in AngularJS ui-grid

Tony picture Tony · May 21, 2015 · Viewed 41.5k times · Source

In AngularJS ui-grid , how can I configure the grid so that it can auto adjust the width of the columns according to the contents when it render?

I know there is a tutorial showing the auto size function, but that works only when you double click the column, I wish it could happen when the grid is initiated.

Answer

cramroop picture cramroop · May 22, 2015

use an asterisk in your column definition:

width:"*";