primeng icon indicating copy to clipboard operation
primeng copied to clipboard

PrimeNG p-table setting [scrollable] to true breaks column header colspan groupings, setting scrollable to false breaks column width definitions

Open dcanning opened this issue 4 years ago • 4 comments

Describe the bug

If I turn on the scrollable property, colspan is not working for table headers. If you turn off the scrollable property, column width definitions are not respected.

Environment

Angular version: 13.3.11
PrimeNG version: 13.4.1
Browser: Chrome/firefox

Reproducer

https://stackblitz.com/edit/primeng-tablescroll-demo-qmxhq3?file=src/app/app.component.html

Angular version

13.3.11

PrimeNG version

13.4.1

Build / Runtime

TypeScript

Language

TypeScript

Node version (for AoT issues node --version)

16.15.1

Browser(s)

No response

Steps to reproduce the behavior

  1. In the stackblitz demo, notice that when the page first loads and scrollable is on. Note that the column widths as defined in the table are respected with this setting.
  2. click the "show grouped headers" button.
    1. note that the "Identity" and "The Rest" headers are both at the beginning of the row. Identity has a colspan of 2 so it should cover the Name and Id columns. "The Rest" has a colspan of 7 so should cover all the other columns.
    2. note that scrolling horizontally correctly keeps the Identity column from scrolling, but it not the correct width. "The Rest" column scrolls properly, but is still not the correct width.
  3. click the "turn off scrollable" button.
    1. Note that the "Identity" and "The Rest" column headers now correctly span columns.
    2. Note that the widths as specified in the table are no longer respected. The name column is defined to be 500px.

the grouped column headers ("Identity", "The Rest") Are correctly position with Identity over the first 2 columns (according to it's colgroup="2" setting) and "The Rest" are over the next 7. With scrollable off the pFrozenColumn has no effect. Click the "Turn On Scrollable" button to turn the table scrollable property to true. The

Expected behavior

using table headers with colgroup should correctly work with scrollable property. using column width settings should correctly work without scrollable property.

dcanning avatar Jun 30 '22 17:06 dcanning

probably related #11640

dcanning avatar Jun 30 '22 17:06 dcanning

same problem, please help!

nev-21 avatar Oct 16 '22 01:10 nev-21

In my case adding this to css fixed the problem with scrollable and col sizes, even though i have to set width for cols manually . Edit: .taula_scrollabe is a div that contains the table

.taula_scrollable {
  & * .p-datatable-thead {
    display: flex !important;
    flex-direction: column !important;

    & > tr {
      display: flex !important;
      flex-direction: row !important;
    }
  }

  & * .p-datatable-thead > tr > th,
  .p-datatable-scrollable .p-datatable-tbody > tr > td,
  .p-datatable-scrollable .p-datatable-tfoot > tr > td {
    flex: unset;
  }
}

azc-wm avatar Oct 25 '22 15:10 azc-wm

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

mertsincan avatar Nov 09 '22 21:11 mertsincan