Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollable table may misalign when there is less data then scrollHeight #5013

Closed
jw61 opened this issue Jan 29, 2018 · 2 comments
Closed

Scrollable table may misalign when there is less data then scrollHeight #5013

jw61 opened this issue Jan 29, 2018 · 2 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@jw61
Copy link

jw61 commented Jan 29, 2018

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
See my plunk: https://plnkr.co/edit/Y45WRBI6EAEaAfNml7VG?p=preview

Current behavior
Thanks for your previous suggestion to use pTemplate="colgroup" for setting column widths with p-table.

However, with p-table 5.2.0-rc.2, if you set the columns widths as percentages with pTemplate="colgroup", set [scrollable]="true", but set scrollHeight large enough that a scroll bar is not displayed, then the header columns and body columns do not line up because the body is wider than the header.

Expected behavior
If the scroll bar is not displayed, the space on the right of the header should be hidden too, making the columns line up again.

Minimal reproduction of the problem with instructions
See my plunk: https://plnkr.co/edit/Y45WRBI6EAEaAfNml7VG?p=preview

  • Create a p-table with four columns and four rows
  • Set different columns widths as percentages with a pTemplate="colgroup"
  • Set [scrollable]="true"
  • Set scrollHeight large enough that a scroll bar is not displayed
  • The header and body columns do not line up

What is the motivation / use case for changing the behavior?
A table where the header lines up with the body columns

Please tell us about your environment:
Angular CLI: 1.6.3
Node: 8.9.4
OS: win32 x64
Angular: 5.2.1

  • Angular version: 5.2.1

  • PrimeNG version: 5.2.0-rc.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Chrome: 63

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Typescript 2.4.2

  • Node (for AoT issues): node --version =
    Node: 8.9.4

@garrettld
Copy link

garrettld commented Jan 29, 2018

I was about to submit an issue for this same thing.

The old DataTable component checked hasVerticalOverflow() before setting the scrollbar width property

let scrollBarWidth = this.hasVerticalOverflow() ? this.domHandler.calculateScrollbarWidth() : 0;

but the new TurboTable does not

let scrollBarWidth = this.domHandler.calculateScrollbarWidth();

Restoring some kind of check like that should fix this issue. I was able to work around this by checking for vertical overflow myself inside ngOnChanges().

@cagataycivici cagataycivici self-assigned this Jan 31, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jan 31, 2018
@cagataycivici cagataycivici changed the title [ TurboTable ] / p-table Header columns don't line up with body columns Scrollable table may misalign when there is less data then scrollHeight Jan 31, 2018
@cagataycivici cagataycivici added this to the 5.2.0-RC3 milestone Jan 31, 2018
@jw61
Copy link
Author

jw61 commented Feb 2, 2018

Hi @cagataycivici , thanks for the fix. It works great now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants