NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.85k stars 3.9k forks source link

nzTable: nzWidth working wrong with colspan #6999

Open KangHidro opened 2 years ago

KangHidro commented 2 years ago

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-ivy-3gn1dd?file=src/app/app.component.ts

Steps to reproduce

  1. Create a nz-table with 2 row of thead, using rowspan and colspan
  2. The last column using nzRight
  3. Set nzWidth for each column in FIRST row, except the column using colspan
  4. Set nzWidth for each column in SECOND row
  5. Set nzScroll "x" value by sum of all nzWidth value

What is expected?

The second row of thead must be set to expected size

What is actually happening?

In the second row of thead: the last column is wrong size and it biggest

Environment Info
ng-zorro-antd 11.4.2
Browser Chromium 86.0.4240.198 // Edge 94.0.992.38
gxuqin commented 2 years ago

I met the same thing too. I inspected the table HTML element, the col elements in both colgroups of ant-table-head and ant-table-body table do not include the second-row cols shown as follows:

  <col style="width: 60px; min-width: 60px;">
  <col><!-- I think this line should be replaced with following tow lines or something else-->
  <!--
  <col style="width: 70px; min-width: 70px;">
  <col style="width: 70px; min-width: 70px;">
  -->
  <col style="width: 200px; min-width: 200px;">
  <col style="width: 50px; min-width: 50px;">

image

KangHidro commented 2 years ago

Hello! Any update? 😂

KangHidro commented 1 year ago

Today I had this error again and I come back here with the hope that it will be corrected soon 🥹

Nosfistis commented 1 year ago

This is caused because the <col> does not have any span attribute, which causes the width to be applied on the nth column of the table, of whichever row has that column first.

solanik26 commented 1 year ago

Hello, is there any update or solution on this issue?

KangHidro commented 1 year ago

Hello, is there any update or solution on this issue?

No, Maybe this issue is not important enough 😔

scorpionofwar commented 3 months ago

Problem is sadly still not fixed. Has anyone found any workaround?