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

p-table scrollHeight="flex" requires virtualScroll in flex layout #9025

Closed
remackgeek opened this issue Jul 9, 2020 · 10 comments
Closed

p-table scrollHeight="flex" requires virtualScroll in flex layout #9025

remackgeek opened this issue Jul 9, 2020 · 10 comments

Comments

@remackgeek
Copy link

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

Current behavior

In a pure flex layout, where the p-table containing element has no fixed size, just something like "flex:1", setting scrollHeight="flex" does not set scrolling on the body, renders all the rows.

For an example, see : this stackblitz

Adding [virtualScroll]="true" causes the table to scroll correctly, see: this this stackblitz

Expected behavior

A scrollable table with fixed data should not require virtualScroll in a flex layout to properly size to the parent container

Minimal reproduction of the problem with instructions
see this stackblitz

What is the motivation / use case for changing the behavior?

requiring virtualScroll for fixed data complicates sorting and searching

Please tell us about your environment:

  • Angular version: 9.x
  • PrimeNG version: 9.1.3
  • Browser: [Chrome ]
@yigitfindikli yigitfindikli added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Nov 23, 2020
@chetakagrawal
Copy link

I am seeing the same problem. Do we have an update on this issue?

@vds-simon-lapointe
Copy link

We have this problem as well. I'd like an update as well.

@PotatoesMaster
Copy link

PotatoesMaster commented Aug 9, 2021

I have a workaround in place for this problem (I am using Angular 12 and PrimeNG 12, but I don't think it matters in this case).

I added a min-height to the "datatable-scrollable-wrapper" internal element of the table :

// here in root styles.(s)css
// (this could alternatively be added in a component style, in which case ng-deep is required)
.p-datatable-scrollable-wrapper {
  min-height: 0;
}

I also made sure to have a min-height on flex-sized parent elements of the table.

The scrollbar appears as expected and as needed with a p-table having [scrollable]="true" and scrollHeight="flex", without the need to enable virtual scrolling.

@spierala
Copy link

Also have this issue. It can be reproduced in primeng 12.2.1

@ErikPhilips
Copy link

The only way I've gotten it to work within other flex elements is by overriding some of the defaults:

.p-datatable-flex-scrollable .p-datatable-wrapper {
  flex-basis: auto !important;
  height: 0 !important;
}

@leonardoporro
Copy link

The only way I've gotten it to work within other flex elements is by overriding some of the defaults:

.p-datatable-flex-scrollable .p-datatable-wrapper {
  flex-basis: auto !important;
  height: 0 !important;
}

works for me, this should be added to source

@mertsincan
Copy link
Member

Hi,

We changed our virtualScroll implementation. We designed a new scroller API instead of Angular cdk and used it in all components. So, I think this issue has already been fixed.
#11656

If the problem persists, please reopen this ticket. Thanks a lot for your understanding!

Best Regards,

@mertsincan mertsincan removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Jun 28, 2022
@philippwaller
Copy link
Contributor

@mertsincan: Thanks for the update. I am using v14.0.1 and the problem still persists. Fortunately, @leonardoporro's fix still works.

@remackgeek: I would suggest to reopening this ticket.

@buchatsky
Copy link

buchatsky commented Jun 21, 2023

Really it is enough to change flex: 1; for flex: 1 1 0; in table.css for .p-datatable-flex-scrollable > .p-datatable-wrapper (v16.0.0)

@vcucchiara
Copy link

The only way I've gotten it to work within other flex elements is by overriding some of the defaults:

.p-datatable-flex-scrollable .p-datatable-wrapper {
  flex-basis: auto !important;
  height: 0 !important;
}

works for me, this should be added to source

I have been battling this for a while. This suggestion worked for me. Thx for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests