jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.75k stars 827 forks source link

Update width of additional (multiple) headers #261

Closed mgbearda closed 5 years ago

mgbearda commented 5 years ago

When you have multiple headers the width of the additional headers are not updated when the width is changed. example: https://bossanova.uk/jexcel/examples/headers The reason for this is that the width is not parsed as an value.

Solution: replace line 735-740:

// Update any nested cells
if ($(nestedHeaders).length > 0) {
    $.each(nestedHeaders, function(k, v) {
        $(v).prop('width', $(v).prop('width') + ($.fn.jexcel.resizeColumn.width - newWidth));
    });
}

with

// Update any nested cells
if ($(nestedHeaders).length > 0) {
    $.each(nestedHeaders, function(k, v) {
        $(v).prop('width',  parseInt($(v).prop('width')) - $.fn.jexcel.resizeColumn.width + newWidth + 'px');
    });
}
pphod commented 5 years ago

Nested headers works very differently in the new version. Please check the same example out using the v2.0.0.