I'm submitting a ...
[ x] bug report => Search github for a similar issue or PR before submitting
Plunkr Case (Bug Reports)
http://plnkr.co/edit/3lEald21ZAvXb7rbD9iI?p=preview
Current behavior
Upon reducing height of the browser window, data table height is not changed to match height of its container and its container displays scrollbar.
Expected behavior
Upon reducing height of the browser window, data table height is changed to match height of its container and its container does not display scrollbar.
Minimal reproduction of the problem with instructions
Maximize browser window and run plnkr -- data table is correctly displayed with scrollbar.
Reduce height of the browser window -- data table height is not changed and its container displays scrollbar.
What is the motivation / use case for changing the behavior?
Current behavior is a candidate for a defect.
Please tell us about your environment:
Windows 7 x64
Angular version:
4.0.0 and 5.0.3
PrimeNG version:
4.2.2, 5.0.0 and 5.0.3
Browser:
Chrome 62.0.3202.89 and 62.0.3202.94
Language:
TypeScript 2.4.2 and 2.6.2
I believe this also is a defect going from shorter to taller. If you start with a reduced height window, than resize your window to a full height window, the datatable stays the same height as the original.
We fixed this by calling initiScrolling inside a window resize listener:
export class ScrollableView implements AfterViewInit, AfterViewChecked, OnDestroy {
@HostListener('window:resize', ['$event'])
onResize(event) {
if (event && this.dt.initialized) {
console.info("init scrolling after window resize");
this.initScrolling();
}
}
// ...
}
This also happens when you place a datatable inside of a p-dialog :(
I met this problem too, how to solve that? Or any other methods to suit window resize for datatable?
p-dataTable is deprecated and will be removed in favor of the new p-table (aka TurboTable) of 5.1.0 so closing the issue. Please try the new p-table once 5.1.0 is released.
Most helpful comment
This also happens when you place a datatable inside of a p-dialog :(