Aligned Grids

Aligning two or more grids means columns will be kept aligned in all grids. This means column changes in one grid (for example, changes to column width, column order, and column visibility) are reflected in the other grid. This is useful if you have two grids, one above the other and you want to keep the columns aligned.

Configuration

To have one (the first) grid react to column changes in another grid (the second), provide the second grid with a reference to the first grid.

grid_two = dag.AgGrid(
    id="grid-two",
    # other props
)

grid_one = dag.AgGrid(
    id="grid-one",
    dashGridOptions={'alignedGrids': ['grid-2'],
    # other props
)

Aligned Grids Basic Example

Below shows two grids, both aligned with the other (so any column change to one will be reflected in the other). The following should be noted:

Events

The events which are fired as part of the grid alignment relationship are as follows:

Pivots

The pivot functionality does not work with aligned grids. This is because pivoting data changes the columns, which would make the aligned grids incompatible, as they are no longer sharing the same set of columns.

So why would you want to align grids like this? It’s great for aligning grids that have different data but similar columns. Maybe you want to include a footer grid with ‘summary’ data. Maybe you have two sets of data, but one is aggregated differently to the other.

This example is a bit more useful. In the bottom grid, we show a summary row. Also note the following: