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设置了scroll.y之后出现了错位 #19018

Closed
1 task done
Jkanon opened this issue Sep 26, 2019 · 10 comments
Closed
1 task done

table设置了scroll.y之后出现了错位 #19018

Jkanon opened this issue Sep 26, 2019 · 10 comments
Assignees

Comments

@Jkanon
Copy link

Jkanon commented Sep 26, 2019

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

Reproduction link

https://codepen.io/Jkanon/pen/oNvOvKP

Steps to reproduce

看demo

What is expected?

能够正常对齐

What is actually happening?

表头和内容错位

Environment Info
antd 3.23.4
React 16.8.6
System win7
Browser chrome 77
@afc163
Copy link
Member

afc163 commented Sep 26, 2019

@afc163 afc163 closed this as completed Sep 26, 2019
@Jkanon
Copy link
Author

Jkanon commented Sep 26, 2019

@afc163 但是我都指定width或者保留一列不设宽度,并没有用,现在有解决方案吗

@afc163
Copy link
Member

afc163 commented Sep 26, 2019

#13825 (comment)

有一列是超长连续字段,具体解决方案见上方。

@Jkanon
Copy link
Author

Jkanon commented Sep 26, 2019

@afc163 好的谢谢,在demo中直接嵌套添加style是可以的,我一开始有在我系统中添加全局样式,不知怎的没有效果,那我还是再嵌套一层好了。

@Jkanon
Copy link
Author

Jkanon commented Sep 26, 2019

@afc163 我更新了demo,给其中的两个长字段都添加上了<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}>,但是还是有些许错位
JPB)~%D{TQUZBGD TIJNUN

@afc163
Copy link
Member

afc163 commented Sep 26, 2019

.wrapper .ant-table .ant-table-scroll .ant-table-header {
  padding-right: 3px;
}

Remove this.

@Jkanon
Copy link
Author

Jkanon commented Sep 27, 2019

@afc163 我已经去除了这个样式了,但是还是不行的。可能在某些分辨率的窗口下是正常的,我昨天也是这样被骗了,但是你可以改变浏览器窗口看下,还是会错位的

@Jkanon
Copy link
Author

Jkanon commented Sep 27, 2019

好吧,可能是width总和超过了窗口大小就会出现这问题,添加了scroll.x就正常了。
目前表格使用起来有点变扭
1、用户的屏幕尺寸我们控制不了,强行width无法适配所有的电脑
2、感觉没有标准的解决方案,遇到问题得各种尝试
同时我就纳闷了,不设置scroll.y就没问题

@Jkanon
Copy link
Author

Jkanon commented Sep 27, 2019

我更新了demo,又出现了个问题,我本来想设置scroll.x为max-content以解决后顾之忧,但是配合上fixed:right的列的情况下,最后一个非fixed列被挡住了
补充:经测试,是留空了一列的width造成的
所以就和上面说的一样,得各种尝试,不友好,所以这些问题肯定会源源不断地被issue出来

@afc163
Copy link
Member

afc163 commented Sep 27, 2019

目前的方案是这样的,需要适应的情况很多,4.0 会想办法从底层做一次技改。

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

3 participants