Kle
Kle

Reputation: 1043

Defining autosize column for only one spesific column is possible for ag-grid?

I want to make auto size content for one spesific column at ag-grid. But I think this autoSizeColumns proeprty for all grid columns. What can I do? Is there anything else?

Upvotes: 1

Views: 223

Answers (1)

Hyyan Abo Fakher
Hyyan Abo Fakher

Reputation: 3537

autoSizeColumns(colKeys) accepts an array of column IDs to auto size based on their content.

gridOptions.columnApi.autoSizeColumns(["SOME_COLUMN_ID"]);

Also setting the minWidth && maxWidth in the column definition will lock the column size regardless of dragging the header or using one of the API methods.

Upvotes: 2

Related Questions