DT 1.10.7 chokes on colspan with visibility-toggling

DT 1.10.7 chokes on colspan with visibility-toggling

rgavrilovrgavrilov Posts: 13Questions: 6Answers: 0

I have reduced the failing case to bare bones: http://live.datatables.net/buricayu/1/

when page renders (Chrome) it shows an error in the console:

Uncaught TypeError: Cannot read property 'style' of undefined

The code used to work with 1.10.3. Between .3 and .7 there has been a change in DT in _fnCalculateColumnWidths

in .3 tmpTable was extended with head from oSettings:

.append($(oSettings.nTHead).clone(false))

So when we get headerCells:
headerCells = _fnGetUniqueThs(oSettings, tmpTable.find('thead')[0]);

at this point thead is the one that has been updated by _fnDrawHead call in __setColumnVis function.

But .7 _fnCalculateColumnWidths looks up head from tmpTable = $(table).clone().find("thead")[0] which, for reasons I don't understand, is different from oSettings.nTHead.

As a result oSettings.nTHead has correct number of columns, but $(table).clone().find("thead")[0] has fewer columns then visibleColumns.length (line 3891)

Which results in the error few lines later:

            headerCells = _fnGetUniqueThs(oSettings, tmpTable.find('thead')[0]);

            for (i = 0; i < visibleColumns.length; i++) {
                column = columns[visibleColumns[i]];

                /* error --> */ headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
                    _fnStringToCss(column.sWidthOrig) :
                    '';
            }

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    Thanks for flagging this up. There was a change in 1.10.7 for IE7 compatibility in this area of the code, so I suspect that is what is going wrong. I'm just about to look into it and will post back shortly.

    Allan

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    I've just committed a fix for this and I'll rebuild the nightly in just a few minutes with the fix.

    Thanks again,
    Allan

This discussion has been closed.