-
Notifications
You must be signed in to change notification settings - Fork 363
fix: resolve mismatch between drag indices and update checkbox logic for groups issue 3975 #4008
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
Open
PoorShawn
wants to merge
9
commits into
VisActor:develop
Choose a base branch
from
PoorShawn:fix/3975
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix: update checkbox status in rowMov of tree ListTable
调整顺序的时候有报错,再看一下吧 20250612-153506.mp4 |
嗯嗯好滴,我再看看是哪里出问题了 |
@Rui-Sun 感谢你的测试!想问问可以提供测试的相关代码吗?方便我定位问题和错误 |
@Rui-Sun 原来是我忽略了对于 Pivot 透视表和转置表的处理,现在应该 OK 了! |
@Rui-Sun 您好,我注意到这是一段 PivotTable 透视表的配置(没有复选框)。经过测试,在行移动的时候,没有发现什么问题 |
我又测试了一下,看起还是有问题,麻烦再看一下这个例子
|
为我的疏忽感到抱歉,我将再仔细地检查和测试。非常感谢你耐心的测试和沟通! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
relate #3975
💡 Background and solution
🐞问题一(Issue 1):“刻舟求剑”索引错误
在 checkbox.ts 中,source 和 target 的索引映射是通过 getRecordIndexByCell() 函数,根据 sourceIndex 和 targetIndex 的行号来获取的。
然而该函数内部依赖 _currentPagerIndexedData 进行索引查找,而这个数据已经是拖拽处理之后的结果。
与此同时,sourceIndex 和 targetIndex 依然代表的是拖拽处理前的行号。
因此,source 和 target 的索引映射会出现不一致,导致逻辑错误。
🛠️ 解决方法一
在数据源更新前,提前获取源记录和目标记录的索引信息。
在 endMoveCol 中,在调用 changeRecordOrder 之前,预先通过 getRecordIndexByCell() 获取并保存索引数据,确保索引准确无误。
🐞 问题二(Issue 2):组间/组内移动未保持 checkbox 状态
当整组(group)移动时,其内部的子项和子孙项未能正确保持其 checkbox 状态。
同样地,组内不同层级的移动,也会出现 checkbox 状态丢失或错乱的情况。
🛠️ 解决方法二
对于组级别的移动:使用 key.startsWith(${sourceIndex}) 来确保组内所有子项同步移动,并保持 checkbox 状态一致。
对于组内任意层级的移动:通过判断路径长度相等且共享相同的父路径,实现对同一层级的识别,并借助 parentPath 维持父级上下文,仅在同一父节点下完成移动。
对于包含嵌套子项的复杂移动:通过前缀匹配策略,使用如下正则精确定位和移动子项:
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough