Using ScrollX/Y Prevents Hiding/Showing Columns

Using ScrollX/Y Prevents Hiding/Showing Columns

NMcCloudNMcCloud Posts: 15Questions: 7Answers: 0
edited May 2015 in Bug reports

If the table has scrollX/scrollYdefined, 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().visible(), then, five seconds later, they are shown again. The error occurs when the visible method is called. The visibleColumns array is being increased before the headerCells array is, which is causing the error.

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

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. Not entirely sure if _fnScrollDraw should be split into two parts, one to be called before the calculation, and one after.

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

Thanks

Ken

Answers

This discussion has been closed.