Using superheaders breaks resizing

Using superheaders breaks resizing

rgavrilovrgavrilov Posts: 13Questions: 6Answers: 0
edited July 2016 in Free community support

I have a table that uses two rows of headers:
| Person | // colspan = 2
| First Name | Last Name |
| Bob | Smart |

Because number of columns and headers is now different, datatables handles column widths explicitly. And table doesn't respond to browser window resizing any longer.

However adding style="width:100%" on the table cures this.

Am I doing something wrong? Is this expected behavior?

version DataTables 1.10.7

The "resize watching" mechanism is enabled if tableWidthAttr variable is truthy, tableWidthAttr is computed as follows:

        var tableWidthAttr = table.getAttribute('width'), // from DOM element
        var styleWidth = table.style.width;
        if (styleWidth && styleWidth.indexOf('%') !== -1) {
            tableWidthAttr = styleWidth;
        }

Which looks for in-line style and width attribute only, but does not consider width set through CSS, so even if CSS has width: 100% I still need to repeat that in width attribute or inline style.

--roman

Answers

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin

    First thing to do is to try the current release - 1.10.12. The second thing, if that doesn't fix it, is to link to a test page showing the issue.

    Thanks,
    Allan

This discussion has been closed.