Autofit layout
is defined by setting scrollModel.autoFit = true
. In this layout:
-
The grid automatically calculates column widths to ensure the best fit within its total width.
-
Whenever the grid is resized or maximized, the column widths are dynamically recalculated.
-
Horizontal scrolling remains unnecessary, and the scrollbar stays hidden unless the combined minimum widths or percentage widths of all columns exceed the grid's width, making it impossible to accommodate them all.
Column width constraints
While computation of column widths, they are subject to following constraints:
- Minimum width of column
column.minWidth
- Maximum width of column
column.maxWidth
- Percent width of column
column.width = 'x%'
Note that specifying fixed width of a column is ignored by grid as it''s dynamically calulcated by the grid.
How to fix width of a column?
Since directly specifying fixed width of a column e.g., column.width = x
is ignored by the grid,
it can be achieved by specifying same value of both column.minWidth
and column.maxWidth