Full Width Rows
Under normal operation, ag-Grid will render each row as a horizontal list of cells. Each cell in the row will correspond to one column definition. It is possible to switch this off and allow you to provide one component to span the entire width of the grid and not use columns. This is useful if you want to embed a complex component inside the grid instead of rendering a list of cells. This technique can be used for displaying panels of information.
Simple Example of Full Width Rows
Below shows a simple example using full width. The following can be noted:
- The rows for countries France, Italy and Peru have full width components instead of cells.
- Sorting and filtering all work as if the data was displayed as normal.
Understanding Full Width
A fullWidth (full width) component takes up the entire width of the grid. A fullWidth component:
- is not impacted by horizontal scrolling.
- is the width of the grid, regardless of what columns are present.
- is not impacted by pinned sections of the grid, will span left and right pinned areas regardless.
- does not participate in the navigation, rangeSelection (ag-Grid Enterprise) or contextMenu (ag-Grid Enterprise) of the main grid.
fullWidth, you must:
- Implement the
isFullWidthCell(rowNode)callback, to tell the grid which rows should be treated as fullWidth.
- Provide a
fullWidthCellRenderer, to tell the grid what cellRenderer to use when doing fullWidth rendering.
The cell renderer can be any ag-Grid cell renderer. Refer to Cell Rendering on how to build cell renderers. The cell renderer for fullWidth has one difference to normal cell renderers, that is the parameters passed are missing the value and column information as the cellRenderer, by definition, is not tied to a particular column. Instead you should work off the data parameter, which represents the value for the entire row.
isFullWidthCell(rowNode) callback takes a rowNode as input and should return a boolean true
(use fullWidth) or false (do not use fullWidth and render as normal).
Sorting and Filtering
Sorting and Filtering are NOT impacted by full width. Full width is a rendering time feature. The sorting and filtering applied to the data is done before rendering and is not impacted.
Detailed Full Width Example
Below shows a detailed full width example including pinned rows and columns. The example's data is minimalistic to focus on how the full width impacts rows. For demonstration, the pinned rows are shaded blue (with full width a darker shade of blue) and body full width rows are green. The following points should be noted:
- Full width can be applied to any row, including pinned rows. The example demonstrates full width in floating top, floating bottom and body rows.
Full width rows can be of any height, which is specified in the usual way using the
getRowHeight()callback. The example sets body fullWidth rows to 55px.
- The floating full width rows are not impacted by either the vertical or horizontal scrolling.
- The body full width rows are impacted by vertical scrolling only, and not the horizontal scrolling.
- The full width rows span the entire grid, including the pinned left and pinned right sections.
- The full width rows are the width of the grid, despite the grid requiring horizontal scrolling to show the cells.
- The example is showing a flat list of data. There is no grouping or parent / child relationships between the full width and normal rows.
Embedded Full Width vs Normal Full Width
The grid uses a trick of placing the full width rows in another div, outside of the main rows and cells. This is what allows the full width rows to span across the pinned areas. One downside of this approach is speed in slower browsers (eg Internet Explorer) where vertical scrolling results in a lag, where the full width rows scroll after the main rows scroll.
If you want to embed the full with rows with the rest of the rows, and not be impacted by the scrolling
performance issue, then set
embedFullWidthRows=true. The example below demonstrates as follows:
- The full width rows are embedded with the main rows.
- Each full width row is split into the pinned areas.
- Each full width row horizontally scrolls with the main grid.