Add more white space or pack more data into the UI.
--ag-grid-size
is the main control for affecting how tightly data and UI elements are packed together. It should be--ag-row-height
sets the height of a grid row. It often needs fine-tuning when the --ag-grid-size
is changed.--ag-grid-size
that may also need fine-tuning.Here is a simple example setting:
.ag-theme-alpine.compact {
--ag-grid-size: 3px;
}
This CSS class must be added to any *.css
file in the assets folder
(See Loading CSS files for more
information).
If you have made any customisations that affect the height of the header or individual rows - in particular setting the
--ag-row-height
, --ag-header-height
or --ag-grid-size variables
- then you need to understand the effect your
change has on the grid’s virtualised layout.
The grid
uses DOM virtualisation for
rendering large amounts of data, which means that it needs to know the size of various elements like columns and grid
rows in order to calculate their layout. The grid uses several strategies to work out the right size:
ag-theme-alpine
and have notrowHeight
, headerHeight
minWidth
.The grid performs its measurement of elements as described above when it starts up, and it caches the calculated values
internally, so it won’t have to recalculate the size of rows and headers while the Grid is scrolled. To force the grid
to refresh this cache, you should simply change the CSS class applied to the Grid element as shown in the example below:
The following example shows the behavior of the grid setting --ag-grid-size
to different values.
It is also possible to adapt:
--ag-font-size
columnSize="autoSize"
This example uses the following CSS classes:
.ag-theme-alpine.large {
--ag-grid-size: 10px;
}
.ag-theme-alpine.compact {
--ag-grid-size: 3px;
}
.ag-theme-alpine.large.font {
--ag-font-size: 32px;
}
.ag-theme-alpine.compact.font {
--ag-font-size: 10px;
}
These CSS classes must be added to any *.css
file in the assets folder
(See Loading CSS files for more
information).
The following variables are all defined as multiples of --ag-grid-size
, if you’ve updated the grid size and you may
want to update them to fine-tuning the compactness:
CSS Variable | Description |
---|---|
<p><code>‑‑ag‑widget‑container‑horizontal‑padding<code><p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> | The horizontal padding of containers that contain stacked widgets, such as menus and tool panels. |
<p>--ag-widget-container-vertical-padding <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
The vertical padding of containers that contain stacked widgets, such as menus and tool panels. |
<p>--ag-widget-horizontal-spacing <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
The horizontal spacing between widgets in containers that contain horizontally stacked widgets such as the column groups header component |
<p>--ag-widget-vertical-spacing <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
The vertical spacing between widgets in containers that contain vertically stacked widgets. |
<p>--ag-cell-horizontal-padding <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
Horizontal padding for grid and header cells (vertical padding is not set explicitly, but inferred from row-height / header-height. |
<p>--ag-row-height <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
Height of grid rows. |
<p>--ag-list-item-height <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
Height of items in lists (example of lists are dropdown select inputs and column menu set filters). |
<p>--ag-column-select-indent-size <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
How much to indent child columns in the column tool panel relative to their parent. |
<p>--ag-set-filter-indent-size <p><p>CSS length - like ‘0’, ‘4px’ or ‘50%’<p> |
How much to indent child filter items in the Set Filter List relative to their parent. |
<br>