primefaces / primeui

Rich set of javascript-css only widgets
http://www.primefaces.org/primeui
278 stars 125 forks source link

Sticky header fails to resize with table #235

Closed StephenCWills closed 6 years ago

StephenCWills commented 8 years ago

The issue as described by pull request #226.

Ran into issues where the stickyHeader would not resize when the puidatatable's width changed as the result of a scrollbar appearing or disappearing, for instance when the number of rows in the data table changes.

To replicate, apply "overflow-y: auto" to the style of the div containing the puidatatable. If there is enough data in the table to make the scrollbar appear, the sticky header's width will have been calculated incorrectly.

http://jsfiddle.net/staphen/1ez0motc/

FYI, I believe this issue is not limited to times when the scrollbar appears and disappears. The core of the problem is that the sticky header only resizes when the window resizes, not when the data table resizes. Programmatically changing the width of the containing div will also cause the table to resize without resizing the sticky header.

StephenCWills commented 8 years ago

Using the latest code (https://github.com/primefaces/primeui/commit/032bdbd3ddbe65570080a74c20afe2c2565f0fb0) it seems the sticky header size is calculated correctly when the puidatatable is initialized. However, there is still a problem when the data is updated after initialization. It's worth noting that in my case, I am not programmatically updating the size of the container div, but rather the number of rows in the data table. The following jsfiddle is a better representation of the issue. http://jsfiddle.net/staphen/bc2q85n4/