Search code examples
handsontable

Wrap text on custom headers in handsontable


Is there a way to auto wrap text on colHeaders when given colWidths? It doesn't seem to work and even manually reducing the size of the columns is prohibited.

Relevant options:

hot = new Handsontable(container, {
    data: items,
    startRows: 1,
    minSpareRows: 1,
    colHeaders: ['aaaaaaaa', 'bbbbbbb', 'cccccccccccc'],
    colWidths: [50,50,50]
    manualColumnResize: true,
    autoWrapRow: true
}

Solution

  • Maybe try add some CSS into your headers:

    .handsontable table thead th {
      white-space: pre-line;
      max-width: /* enter here your max header width */
    }