feat: provide default callbacks for Row Move plugin when null#2577
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2577 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 196 197 +1
Lines 25279 25325 +46
Branches 8922 8934 +12
=======================================
+ Hits 25279 25325 +46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
angular-slickgrid
aurelia-slickgrid
slickgrid-react
slickgrid-vue
@slickgrid-universal/angular-row-detail-plugin
@slickgrid-universal/aurelia-row-detail-plugin
@slickgrid-universal/react-row-detail-plugin
@slickgrid-universal/vue-row-detail-plugin
@slickgrid-universal/binding
@slickgrid-universal/common
@slickgrid-universal/composite-editor-component
@slickgrid-universal/custom-footer-component
@slickgrid-universal/custom-tooltip-plugin
@slickgrid-universal/empty-warning-component
@slickgrid-universal/event-pub-sub
@slickgrid-universal/excel-export
@slickgrid-universal/graphql
@slickgrid-universal/odata
@slickgrid-universal/pagination-component
@slickgrid-universal/pdf-export
@slickgrid-universal/row-detail-view-plugin
@slickgrid-universal/rxjs-observable
@slickgrid-universal/sql
@slickgrid-universal/text-export
@slickgrid-universal/utils
@slickgrid-universal/vanilla-bundle
@slickgrid-universal/vanilla-force-bundle
commit: |
|
🎉 This pull request is included in version 10.7.0 📦 |
Ari4ka
approved these changes
May 9, 2026
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
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.
provide default implementation for Row Move callback handlers with
onBeforeMoveRowsandonMoveRowsbut only when user doesn't provide any themselves. So this won't be a breaking change and the user can provide custom logic if wanted. The goal of this new feature is really to avoid having to re-implement the same logic over and over for every grid that we want to use Row Move since it's roughly the same code logic (it's always the same in the demos anyway)Note: these new default implementation won't work with Tree Data, but that's rarely used anyway, and if that happens then the end user will still have to provide their own custom code for both
onBeforeMoveRowsandonMoveRowscallbacksSo user can now delete their implementation and fallback to the defaults (this is optional, user who decide to keep their implementation will still work as intended, the defaults are just fallbacks and are now part of the lib):
this.gridOptions = { // ... enableRowMoveManager: true, rowMoveManager: { columnIndexPosition: 0, // when using Row Move + Row Selection, you want to move only a single row and we will enable the following flags so it doesn't cancel row selection singleRowMove: true, // optionally remove your previous code and use default callbacks - onBeforeMoveRows: this.onBeforeMoveRow.bind(this), - onMoveRows: this.onMoveRows.bind(this), // there is also a new optional callback to get update dataset after the move + onAfterMoveRows: (_e, args) => { + this.dataset = args.updatedItems; + }, }; } - onBeforeMoveRow(e, args) { - // ... - } - onMoveRow(e, args) { - // ... - }