Skip to content

Table row don't trigger the "customRender" function when the toggle mouse hover #5454

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

Closed
1 task
mqhe2007 opened this issue Apr 8, 2022 · 3 comments
Closed
1 task

Comments

@mqhe2007
Copy link

mqhe2007 commented Apr 8, 2022

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

What problem does this feature solve?

对于复杂的自定义列内容,可能需要在“customRender”函数块声明一些变量(可以是响应式变量)来储存渲染组件的状态。比如“操作”列有一个“审批按钮”,“loading”变量声明在“customRender”函数块作用域。点击时发起远程请求,并且设置“loading”状态。现在的情况是鼠标移出行时就会再次触发“customRender”函数,导致重置变量状态。需要有一个开关使“customRender”函数只在初始渲染时触发一次。

For complex custom column content, maybe need to declare some variables (which can be reactive variables) in the "customrender" function block to store the state of the rendering component. For example, there is an "approval button" in the "operation" column, and the "loading" variable is declared in the scope of the "customrender" function block. When clicked, initiate a remote request and set the "loading" status. The current situation is that when the mouse moves, the "customrender" function will be triggered again, resulting in resetting the variable state. A switch is required to trigger the "customrender" function only once during the initial rendering.

What does the proposed API look like?

Table's prop "customRenderOnce"

@buqiyuan
Copy link
Member

buqiyuan commented Apr 8, 2022

我觉得如果你需要保持变量的状态的话,建议将其声明到customRender函数的外层去,而且目前的customRender相当于一个render函数,只触发一次的话后续UI就没办法更新了都。当然,如果要支持你这种需求的话也不是不可以,只要customRender支持以下的写法就行:

{
  customRender() {
   const loading = xxx
   return () => <button loading={loading}></button>
  }
}

@mjlwq
Copy link

mjlwq commented Dec 6, 2022

react 版本没得这个问题奇怪 vue customRender 鼠标移动会自动触发

Copy link

github-actions bot commented Dec 7, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants