Repository navigation
Sorting: resolve sortable callback from the currently sorted columns - #1326
Open
radimvaculik wants to merge 1 commit into
Open
radimvaculik wants to merge 1 commit into
radimvaculik wants to merge 1 commit into
Conversation
Uložený Datagrid::$sortCallback se při přepnutí řazení nevynuloval, takže se callback dříve řazeného sloupce aplikoval na sloupec bez callbacku. createSorting() teď callback vždy zjistí z řazených sloupců (closes #1325).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1326 +/- ##
==========================================
+ Coverage 55.75% 56.19% +0.44%
==========================================
Files 65 65
Lines 3024 3018 -6
==========================================
+ Hits 1686 1696 +10
+ Misses 1338 1322 -16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Refs #1325.
Datagrid::$sortCallbackkept a copy of the sorted column's callback, filled in from three places (handleSort(),findStorageValues(), and a fallback increateSorting()that used the last column in the loop).handleSort()never reset it, so calling it twice on the same instance (sort by a column withsetSortableCallback(), then by a plain one) passed the old callback to the data source. In a real app every request builds a new grid, so this doesn't happen in practice (see the reporter's analysis in #1325). The stored copy is still redundant, because the callback can always be worked out from the sorted columns.createSorting()now resolves the callback from the columns in the current sort (the first column with a callback wins), and the property is removed. An explicitly passed$sortCallbackargument still takes precedence.Behavior change: when several sorted columns have callbacks, the first column's callback is used instead of the last one's.
Note: the protected
$sortCallbackproperty is removed, which affects subclasses that read or set it.This touches the same code as #1320; whichever is merged second will need a rebase.
Validation:
DatagridTest::testSortCallbackOfPreviouslySortedColumnIsNotAppliedsorts twice on one instance and loads data through a filtered export.make tests,make phpstan,make cspass.