JavaScript Data Grid Text alignment
Overview
Text alignment functionality enables you to predefine the horizontal and vertical alignment of how the text is displayed in the cells.
Horizontal and vertical alignment
To initialize Handsontable with predefined horizontal and vertical alignment globally, provide the alignment details in the className
option, for example:
className: 'htCenter'
Cells can be also configured individually by setting up the cells
option. See the code sample below for an example.
Available class names:
- Horizontal:
htLeft
,htCenter
,htRight
,htJustify
, - Vertical:
htTop
,htMiddle
,htBottom
.
Alignment changes can be tracked using the afterSetCellMeta
hook.
Basic example
The following code sample configures the grid to use htCenter
and configures individual cells to use different alignments.
Related API reference
- Configuration options:
- Hooks: