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 表格头有排序以及 Resizable 时,拖拽缩放时 mouseup 将会触发 cell 的 sort #14647

Closed
KentonYu opened this issue Jan 30, 2019 · 9 comments
Labels
❓FAQ issues would be discussed a lot

Comments

@KentonYu
Copy link
Contributor

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

拖拽表格头的大小,在表格头上释放鼠标,会触发 sort

What is expected?

拖拽释放鼠标 不会触发 sort

What is actually happening?

触发了 sort

Environment Info
antd undefined
React 16.x
System mac
Browser chrome latest
@zombieJ
Copy link
Member

zombieJ commented Feb 27, 2019

stopPropagation: https://codesandbox.io/s/1qnmpry8qj

Update the demo: https://codesandbox.io/s/zrj8xvyzxx

@AlwaysBeOk
Copy link

it is not work..

@zombieJ
Copy link
Member

zombieJ commented Mar 16, 2019

@AlwaysBeOk, thanks for notice. Update the demo. Pls check.

@AlwaysBeOk
Copy link

What is the principle?

@zombieJ
Copy link
Member

zombieJ commented Mar 18, 2019

What is the principle?

table use onClick to trigger sorter. The resize block is also a child node of th. So mark it when resizing and not trigger onClick.

@xiaoiver
Copy link

上面的例子中需要修改下这里:

if (!width) {
  // return <th {...restProps} />;
  return <th {...restProps} onClick={onClick} />;
}

否则会出现未设置 width 即不支持拖拽的列无法排序的现象(点击最后一列的排序):
https://codesandbox.io/s/resizeabletable-de23n

@piyushk96
Copy link

piyushk96 commented Jul 10, 2020

Use stopPropagation: https://codesandbox.io/s/1qnmpry8qj

Update the demo: https://codesandbox.io/s/zrj8xvyzxx

@zombieJ
Can you please update the docs as many users are facing this issue. It would be great help for everyone.

@zombieJ
Copy link
Member

zombieJ commented Jul 10, 2020

done

@vaynevayne
Copy link

vaynevayne commented May 24, 2023

多谢, z-index 是多余的
image

.react-resizable-handle {
  position: absolute;
  top: 0px;
  bottom: 0px;
  height: 100%;
  width: 4px;
  border-right: 1px dashed rgb(44, 46, 51);
  cursor: col-resize;
}
.react-resizable-handle:hover {
  background-color: rgb(44, 46, 51);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓FAQ issues would be discussed a lot
Projects
None yet
Development

No branches or pull requests

8 participants