Jmini
Jmini

Reputation: 9497

Access cell alignment in Handsontable

As it can be tested in the align cell demo, handsontable supports cell alignment:

Here a screenshot:

handsontable screenshot

I can access the data with:

$('#table-wrapper').handsontable('getData')

But how can I access the cell alignment?

Upvotes: 2

Views: 2229

Answers (1)

Jmini
Jmini

Reputation: 9497

I think I found the solution. There is a cell method called getCellMeta. It returns an array containing an className entry.

It can be accessed:

var cellMeta = $('#table-wrapper').handsontable('getCellMeta', 0, 0);
var className = cellMeta['className']; //String containing the information.

Values are:

  • Horizontal
    • Left: htLeft
    • Center: htCenter
    • Right: htRight
    • Justify: htJustify
  • Vertical
    • Top: htTop
    • Middle: htMiddle
    • Bottom: htBottom

Of course you can have a combination of two values (for horizontal and vertical) separated with a space.

Upvotes: 1

Related Questions