-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
fix(treeTable): 修复重载数据时,指定参数 scrollPos: 'fixed' 无效的问题 #1892
Conversation
无法实现保持滚动条在原有位置的问题。
Run & review this pull request in StackBlitz Codeflow. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: morning-star <26325820+Sight-wcg@users.noreply.github.com>
Co-authored-by: morning-star <26325820+Sight-wcg@users.noreply.github.com>
主要修改点: 1,通过给done包装函数设置scrollPosPatch标志位,避免重复包装; 2,包装后的done函数执行完毕后,恢复原来的done函数,避免以后再次触发done函数时,仍然执行保持滚动条位置的逻辑;
1. 将修复代码迁移至 updateOptions 2. table done 回调第四个参数,现在可以区分 reloadData 和 renderData
指定
如果想在table切换分页时,也能固定滚动条,可以修改分页时的事件函数jump中调用pullData函数时,指定type为reloadData,可以修正这个问题(不确定会不会引起其他问题。。。)
|
是的,在这个 PR 之后,很容易支持分页切换时仍保持滚动条位置。调试了一遍,应该没问题,分页切换加载数据和 reloadData |
还想到一种修改办法,只修改table.js就可以了。 table和treeTable的代码太复杂了,超越了一个java程序员的能力范围了,只能提供示例代码供参考。
|
这也是一个很好的解决方案,同时能避免更新数据时 table 视图闪烁,有固定列时效果会明显一些。 |
没错,当 注意到晨星将相关代码迁移到了
|
看的津津有味,没想到还是个java大佬 |
大佬们 着急用这个改动,这个改动在layui.js 里面加在哪啊 |
在这个问题修正前,先在自己业务代码里面打个补丁将就着用一下吧 https://stackblitz.com/edit/3mynts-8efyex?file=index.html
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本地测试一切正常。
😃 本次 PR 的变化性质
🌱 本次 PR 的变化内容
在此处列出本次 PR 的每一项改动内容
close treeTable节点展开时,显示的滚动条设置通过设置scrollPos: 'fixed'无法保持 #1891
✅ 本次 PR 的满足条件
Submitted with StackBlitz.