[GH #2667] Issue with Merge cells and column width

Tags: #<Tag:0x00007f135c540c60> #<Tag:0x00007f135c540ad0>

Hi,

I have followed this example here https://handsontable.com/docs/javascript-data-grid/merge-cells/#overview and edited the example to illustrate my problem.

The problem was, when I have a data table of N row, and I merged the last 2 rows, the whole table column is no longer resized to fit the contents.

This is the code of my problem https://jsfiddle.net/aucvbqk2/40/
If I uncomment the code in line 29, the column width will not fit the content anymore

Thank you.

Hi @ss2261

Thank you for sharing the demo.

I think that the origin issue is https://github.com/handsontable/handsontable/issues/2667, as autoColumnSize plugin controls the widths of columns. In this case it ‘thinks’ that the data wrapped to the 2nd row, which is not true.

I will add your case to the internal ticketing system for this issue and update you upon fix.

Thank you. While we are waiting for the fix. Could you suggest any workaround for the problem?

The only workaround I see is to use colWidths to fix the width of the columns, but then you would need to specify the width for all of them. You can alter the widths via updateSettings() if needed but the need to set width for every column might be a limitation (it all depends on your project requirements).

Here https://handsontable.com/docs/javascript-data-grid/api/options/#colwidths is the page in the documentation for this option.

1 Like