fix(selection): copy text selection now working, closes #334 #333
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.
This fixes issue #334 (and possibly #150), in brief user cannot copy text selection when row is the selected row (even when it's the same selected row). Also note that I have
enableTextSelectionOnCells
enable but that was not helping with my issue. This was also mentioned in a very old issue #9, this PR fixes exactly that but at the source instead of in each plugins (checkbox selector was not covered in #9 fix).Origin of the issue
handleSelectedRangesChanged
was always triggering the eventonSelectedRowsChanged
, even when the row selected is exactly the same. That was doing a cascading effect of triggeringhandleSelectedRowsChanged
ofslick.checkboxselectcolumn.js
, which inside had an grid.invalidateRow(row) that was doing the blur effect since the row was getting re-rendered and when that happens it obviously remove text selection focus since the DOM element gets recreated.Fix
We should trigger an
onSelectedRowsChanged
event ONLY when the previously selected row(s) is not the same as the newly selected row(s) and that's it, we don't need to re-render and that fixes text selection.Before the fix (I cannot keep text selection, it always blur away on the selected row)
With FIX