Home/Columns/Aligned Grids
Columns

Aligned Grids

Give two grids the same alignGroup name and they keep one column layout. Resize, reorder, pin or hide a column in either one and the other follows, and they scroll sideways together.

Drag a column border, drag a header, or scroll sideways — in either grid. Neither one is in charge.
Rearrange the columns with the totals grid hidden, then bring it back — it arrives already aligned, scrolled to the same place, without touching the grid above.
Region
Rep
Q1
Q2
Q3
Total
North
Amelia Hart
40000
38000
45000
123000
South
Bruno Salazar
47919
42507
51247
141673
West
Chen Wei
55838
47014
57494
160346
North
Dara Okonkwo
63757
51521
63741
179019
South
Elif Yilmaz
71676
56028
69988
197692
West
Farid Haddad
79595
60535
76235
216365
North
Greta Lindqvist
87514
65042
82482
235038
South
Hugo Marchand
40433
69549
88729
198711
1–8 of 12
Region
Rep
Q1
Q2
Q3
Total
North
4 reps
247542
233126
244446
725114
South
4 reps
224218
251154
269434
744806
West
4 reps
255894
269182
246422
771498
All regions
12 reps
727654
753462
760302
2241418
All records loaded
4 / 4 records

One name, on both grids

Set alignGroup to the same string on every grid you want to keep together:

readonly config: GridConfig = { alignGroup: 'sales' };

That is the whole API. You do not point one grid at the other, and there is no order to declare them in. Grids in different components join the same group as easily as siblings do.

What follows, and what does not

Column width, order, pin and hidden state stay the same in every grid in the group, and the grids scroll sideways together. Drag a column border in the totals grid and the grid above it moves with you.

Rows are left alone. Sorting, filtering, selection and vertical scrolling stay private to each grid — the second grid usually shows different rows, so sorting it by Q2 would mean something else entirely.

Neither grid is in charge

The grid you touched leads and the rest follow, whichever one that is. A grid that renders later adopts the layout the group already has instead of imposing its own, so a grid inside a tab or an @if cannot reset the one already on screen. It picks up the group's sideways scroll position at the same moment, so it never arrives offset from the grids it is meant to line up with. The switch above the grids does exactly that — hide the totals grid, move the columns around, scroll sideways, then bring it back.

When the columns are not the same

Grids that declare different column keys align on the keys they share. A column the other grid does not have keeps its own width and its own position — it is never pushed aside to make room for a layout that never mentioned it.

A column's own minWidth still wins. If one grid declares a wider floor for a shared column, the whole group settles on that floor rather than letting the two draw it at different widths.

Sizing the columns automatically

autoSizeStrategy: { type: 'fitGridWidth' } works with a group, and the layouts settle — but each grid fits to its own container, and the group can only hold one set of widths. Where the containers differ, the group ends up on the narrowest one, so the wider grid does not fill its space. Give linked grids containers of the same width, or size the columns yourself.

Give each linked grid its own persistColumns.key. Two grids saving to one key overwrite each other's layout; in development the grid says so in the console.

Aligned grids API

PropertyTypeDefaultDescription
config.alignGroupstring—Links this grid to every other grid carrying the same name. Column width, order, pin and hidden state stay identical across the group, and the grids scroll horizontally together.
column.resizablebooleantruePer-column. A drag here moves the matching column in every linked grid.
column.draggablebooleanfalsePer-column. Needed for reordering — config.columnReorder on its own moves nothing.
config.persistColumnsColumnPersistConfig—Saved per grid, including layouts that arrived through the link. Give each linked grid its own key.