-
-
Notifications
You must be signed in to change notification settings - Fork 999
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(module: table): Incorrect deselection in virtualized table #3282
fix(module: table): Incorrect deselection in virtualized table #3282
Conversation
…th a virtualized table
Thank you for contribution @rhodon-jargon . I think #3284 is also related the selection, I wonder if we can repair it together? |
Hello @rhodon-jargon , I found the |
I'm looking into it. Regarding #3284, I'm not sure if that's related, though it seems like a very weird bug. If I have time, I'll look into it as well |
@ElderJames the issue should now be fixed. I also discovered that I broke the tree functionality by deleting Also I think #3284's issue was found by zxyao145, and not really a bug. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3282 +/- ##
==========================================
- Coverage 45.39% 43.61% -1.78%
==========================================
Files 560 560
Lines 26851 26839 -12
Branches 268 5453 +5185
==========================================
- Hits 12190 11707 -483
+ Misses 14621 14175 -446
- Partials 40 957 +917
☔ View full report in Codecov by Sentry. |
Can't we merge rowdata with tabledataitem? I think they're almost one to one. |
No, or at least I don't see a way to do it, other than the previous way it was done. (With Therefore, we should keep track of those two in a different way. You are right in that they are almost one to one, because they are in almost all cases. The only case in which they are not is when there is circularly nested data. I originally thought that What I think is also better in the new approach, is that it is now impossible for only one of the rows with the same |
Hello @rhodon-jargon , I'm reviewing this PR again and find another issue that when I select some rows, and remove then by changing SelectedRows outside, it work incorrectly and make the memory explode. |
@ElderJames Good find! It should be fixed now. |
Thank you @rhodon-jargon! I also find the issue that selection in virtualization mode would be clear while the table fetching additional data. I think we need to keep the state inside the table and retore after reload the same data. |
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.
LGTM. Thanks!
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
If you selected a row in a virtualized table with the 'radio' selection type, scrolled down enough that the original row was unloaded, and selected a new row, the old row would not be deselected.
It happened because only the loaded rows were changed. That is now fixed by always deselecting all rowdata, even if unloaded, when selecting a row in 'radio' type.
Also cleaned up the selection code a bit (though it's still a bit cluttered), e.g. removing
_allRowDataCache
as it was not possible for it to contain multiple rowdatas per item, meaning it was the same as_dataSourceCache
.Added some extra overloads of
SetSelection
, I think it would be most ideal to remove theSelection.Key
property (and thus the string overload ofTable.SetSelection
) in the future, maybe somehow giving it access to the TItem of the row so it can call theSetSelection(TItem)
overload (in addition to some other things it would make easier).📝 Changelog
Selection
column will now correctly deselect all other items in a table withEnableVirtualization
.☑️ Self Check before Merge