Skip to content

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.

TypeScript
/* file: app.component.ts */
import { Component } from '@angular/core';
import { GridSettings, HotTableModule} from '@handsontable/angular-wrapper';
@Component({
selector: 'app-example1',
template: `
<hot-table
[settings]="hotSettings!" [data]="hotData">
</hot-table>
`,
standalone: true,
imports: [HotTableModule],
})
export class AppComponent {
readonly hotData = new Array(100) // number of rows
.fill(null)
.map((_, row) =>
new Array(50) // number of columns
.fill(null)
.map((_, column) => `${row}, ${column}`)
);
readonly hotSettings: GridSettings = {
colWidths: 100,
width: '100%',
height: 320,
rowHeaders: true,
colHeaders: true,
fixedRowsTop: 2,
autoWrapRow: true,
autoWrapCol: true,
};
}
/* end-file */
/* file: app.config.ts */
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { registerAllModules } from 'handsontable/registry';
import { HOT_GLOBAL_CONFIG, HotGlobalConfig, NON_COMMERCIAL_LICENSE } from '@handsontable/angular-wrapper';
// register Handsontable's modules
registerAllModules();
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
{
provide: HOT_GLOBAL_CONFIG,
useValue: { license: NON_COMMERCIAL_LICENSE } as HotGlobalConfig,
},
],
};
/* end-file */
HTML
<div>
<app-example1></app-example1>
</div>

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.

Configuration options