Using ScrollY/X Prevents Hiding/Showing Columns

Using ScrollY/X Prevents Hiding/Showing Columns

NMcCloudNMcCloud Posts: 15Questions: 7Answers: 0
edited May 2015 in Free community support

If the table has scrollY/scrollX defined, it prevents the columns from being hidden then shown again.

The bin below shows the error. When first displayed, the last two columns are hidden using column(x).visible(false), then, five seconds later, they are shown again. The error occurs when the visible method is called. It appears the visibleColumns array is being increased before the headerCells array is, which is causing the error.

http://jsbin.com/winonatupi/1/edit

Answers

  • NMcCloudNMcCloud Posts: 15Questions: 7Answers: 0

    Found the source of the bug.

    In _fnAdjustColumnSizing, _fnCalculateColumnWidths is called before _fnScrollDraw. The issue is that _fnScrollDraw adds back the column to the scroll bodies hidden thead element, but _fnCalculateColumnWidths is expecting that column to already be there, which it isn't.

    Simply moving _fnScrollDraw above _fnCalculateColumnWidths seems to fix the issue.

    See https://github.com/DataTables/DataTables/commit/20daefef556b56209985104c14ed3a1b2e5ede61

    Thanks

    Ken

This discussion has been closed.