primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Scrollable DataTable does not change height after its container resize.

Open michaelplavnik opened this issue 9 years ago • 5 comments

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

michaelplavnik avatar Nov 30 '17 18:11 michaelplavnik

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.

gabe-axian avatar Dec 19 '17 18:12 gabe-axian

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();
    }
  }
// ...
}

mqs24d avatar Dec 21 '17 07:12 mqs24d

This also happens when you place a datatable inside of a p-dialog :(

tiger5226 avatar Dec 22 '17 04:12 tiger5226

I met this problem too, how to solve that? Or any other methods to suit window resize for datatable?

una-chou avatar Jan 04 '18 06:01 una-chou

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.

cagataycivici avatar Jan 13 '18 22:01 cagataycivici