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

[table] 使用可滚动的 table,在固定行列,使用 colspan 时,出现错位及行列分离问题 #17871

Closed
1 task done
liuzhenying opened this issue Jul 25, 2019 · 8 comments
Labels
🐛 Bug Ant Design Team had proved that this is a bug. Inactive

Comments

@liuzhenying
Copy link

liuzhenying commented Jul 25, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://codepen.io/Nadia_Lzy/pen/WVxpvM?editors=0010

Steps to reproduce

打开即可见

What is expected?

显示正常

What is actually happening?

  1. 表头和内容宽度不匹配。
  2. 前两行分别声明了 colspan 为 0 和 colspan 为 2,宽度各为 150,但是显然 fix 的表头宽度不够一百,并且 fix left 的也显示异常
Environment Info
antd 3.20.6
React 16.8.6
System mac
Browser chrome

[我做过的尝试] 1. 尝试将一个宽度设置为固定值而非 max-content,但是仍然会出现下列问题
(将上述的 max-content 改成了 2500
[我最后的解决方案]: 1. 砍了需求,要求每个列内部元素都一个宽度,表头也是,这样解决了表头和内容宽度不一致的问题,但是损失了灵活性
2. 将表头硬编码成了 flex 布局,来解决上述问题 2....作为用户,太难修复了

@afc163
Copy link
Member

afc163 commented Jul 29, 2019

https://codepen.io/anon/pen/BXpGVE?editors=0010

这样行不行,全部定宽。


貌似 Firefox 下可以,Chrome 下有问题。

@afc163
Copy link
Member

afc163 commented Jul 29, 2019

很奇怪,感觉是浏览器实现问题。

@afc163 afc163 added the 🐛 Bug Ant Design Team had proved that this is a bug. label Jul 29, 2019
@liuzhenying
Copy link
Author

https://codepen.io/anon/pen/BXpGVE?editors=0010

这样行不行,全部定宽。

貌似 Firefox 下可以,Chrome 下有问题。

ok, 我们使用时是通过内部定宽规避了这个问题,只是觉得是 bug 所以提个 issue 给你们。

@llsldwy
Copy link

llsldwy commented Nov 12, 2019

我也遇到一模一样的问题了,楼主现在有什么解决办法了吗

@liuzhenying
Copy link
Author

我也遇到一模一样的问题了,楼主现在有什么解决办法了吗

我这边把固定的表头,重新用 flex 布局订了下位,内部加上了最小宽度。但觉得这种解法过于 hack,目前看官方似乎还未修复

@llsldwy
Copy link

llsldwy commented Nov 12, 2019

我这边找到一种方式,第一个,定宽,算出scroll的X,第二 修改一个class
ant-table-body-inner {
margin-right: -15px;
}

@afc163
Copy link
Member

afc163 commented Mar 13, 2020

试试 4.x 是不是已经没有这个问题了。

@afc163
Copy link
Member

afc163 commented May 28, 2020

测试了一下 4.0 应该已经好了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug. Inactive
Projects
None yet
Development

No branches or pull requests

5 participants