5

I'm using handsontable and my grids are dynamics. I'm creating them by pushing the data from a XML file. So, the content of the columns are always differents and I want that the width of that columns are defined with the content of the existing cells. If the column contains just "Parley", I want a short width and if I have "One Ring to rule them all", the width should increase.

How should I do please ?

EDIT :

I tried to add : autoColumnSize : true and it works at the beginning, but if I enter a value in a cell, every cells are shrinking.

Before :

enter image description here

After :

enter image description here

And this is the options I use to declare my hot :

var hot_itk = new Handsontable(container, {
        data: data_itk,         
        minSpareRows: 1,
        autoColumnSize : true,
        observeChanges : true,
        columnSorting : true,
        rowHeaders: false,
        colHeaders: false,
        contextMenu: true,
        height: 550,
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Erlaunis
  • 1,433
  • 6
  • 32
  • 50

1 Answers1

2

Have you tried using the stretchH: all option?

var hot_itk = new Handsontable(container, {
    data: data_itk,         
    minSpareRows: 1,
    autoColumnSize : true,
    stretchH: 'all',
    ... 

This stretches the table to the container's width.

adriennetacke
  • 1,726
  • 1
  • 14
  • 21