Row freezing
Lock the position of specified rows, keeping them visible when scrolling.
Overview
Row freezing locks specific rows of a grid in place, keeping them visible while scrolling to another area of the grid.
This feature is sometimes called “pinned rows”.
Example
The following example specifies two fixed rows with fixedRowsTop: 2. Horizontal scroll bars are needed, so set a container width and overflow: hidden in CSS.
import Handsontable from 'handsontable/base';import { registerAllModules } from 'handsontable/registry';
// Register all Handsontable's modules.registerAllModules();
// generate an array of arrays with dummy dataconst data = new Array(100) // number of rows .fill(null) .map((_, row) => new Array(50) // number of columns .fill(null) .map((_, column) => `${row}, ${column}`) );
const container = document.querySelector('#example1');
new Handsontable(container, { data, colWidths: 100, width: '100%', height: 320, rowHeaders: true, colHeaders: true, fixedRowsTop: 2, autoWrapRow: true, autoWrapCol: true, licenseKey: 'non-commercial-and-evaluation',});import Handsontable from 'handsontable/base';import { registerAllModules } from 'handsontable/registry';
// Register all Handsontable's modules.registerAllModules();
// generate an array of arrays with dummy dataconst data: string[][] = new Array(100) // number of rows .fill(null) .map((_, row) => new Array(50) // number of columns .fill(null) .map((_, column) => `${row}, ${column}`) );
const container = document.querySelector('#example1')!;
new Handsontable(container, { data, colWidths: 100, width: '100%', height: 320, rowHeaders: true, colHeaders: true, fixedRowsTop: 2, autoWrapRow: true, autoWrapCol: true, licenseKey: 'non-commercial-and-evaluation',});Freeze rows at the bottom
To pin rows to the bottom edge of the grid — sometimes called footer rows — use the fixedRowsBottom option. The specified number of rows stays visible at the bottom of the viewport while you scroll through the rest of the data.
const hot = new Handsontable(container, { data: getData(), // freeze the last two rows as a footer fixedRowsBottom: 2, licenseKey: 'non-commercial-and-evaluation',});You can combine fixedRowsTop and fixedRowsBottom to keep both a header and a footer row in view at the same time.
Result
After completing this guide, the rows you specify with fixedRowsTop or fixedRowsBottom stay visible while you scroll through the rest of the grid.
Related API reference
Configuration options