Repository navigation
feat(datagrid): filter a table by a cell's value from the cell context menu - #3101
Merged
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Signed-off-by: Ngô Quốc Đạt <[email protected]>
This branch was successfully deployed
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.
Fixes #3066
What it does
Right-click a cell in a table tab and open Filter. The submenu offers conditions built from that cell's stored value, and choosing one adds it to the filter bar and runs it against the whole table:
status = “paid”,status != “paid”, plus>and<on number and date columnsstatus is NULL,status is not NULLstatus is empty,status is not emptyThe item sits just before Highlight, is built by
CellFilterMenuBuilderbehind a newDataGridViewDelegate.dataGridFilterMenuItemhook (nil by default, so only the data tab offers it), and follows the Highlight submenu's shape: one level, no key equivalents, titles cut to 32 characters on one line.Before / After
A new submenu, so there is no before: the cell menu had no filter item at all. After, on an
AlbumIdcell of the Chinook sample, in light and dark:The same shots are in
docs/images/cell-filter-menu*.png.How it combines with filters already applied
The grid shows what it showed AND the new condition, the way Excel's "Filter by Selected Cell's Value", DBeaver and Console's add-to-search work. DataGrip replaces every filter instead, and its users have an open request (DBE-16840) asking for exactly this.
FilterCoordinator.cellFilterStatedoes it in the filter bar's own terms so the bar stays truthful and the saved state restores the same set:executedFiltersrather thanappliedFilters. Rows typed and never applied, and rows Clear left in the bar, resolve as applied under.allwithout having run, so they are unchecked, never deleted.It all runs inside the existing unsaved-edits guard.
applyCommitand the new path now share oneapplyTransition, so state is written and re-queried in one guarded closure.When there is no Filter item
The value goes into the same filter a reader could type, so the item is offered only where that filter matches the clicked row exactly:
=on their servers (ColumnTypeSQLQuoting.hasEqualityOperator)NULLin a non-text column (rendered asIS NULL), and values over 10,000 charactersAlso fixed
HighlightRuleDescription.truncatednow turns line breaks into spaces when it cuts a value for a menu title.NSMenulays a line break out as nothing, so a multi-line cell value ran its lines together in the existing Highlight submenu, and would have in the new one.Known limits, shared with the filter bar
!=leaves out rows where the column is NULL (SQL three-valued logic). The docs say so.ISO8601DateFormatter), so=on a date with milliseconds matches nothing. That is a MongoDB plugin fix of its own.FLOATcolumns is unreliable, as it is when typed into the filter bar.Tests
CellFilterMenuBuilderTests(12): the value-to-condition mapping per value and column type, the round-trip exclusions, titles on one line, and the apply hand-off.CellFilterStateTests(13): the transition from no filters, a running filter on another column and on the same column, rows left by Clear, a draft row, a soloed row stored unchecked, an edited running row, an identical row, Match any with one and with several rows, the find bar's OR search, and the saved state restoring the same rows.CellFilterApplyTests(7): the data tab's menu item, choosing a condition re-queries with it, a second condition narrows the first, a declined discard guard changes nothing, query tabs and edited cells get no item, and the item sits just before Highlight.ColumnTypeSQLQuotingTestsandHighlightRuleDescriptionTestscover the new type rule and the title fix.CellFilterMenuUITests: right-clicks an Album cell, opens Filter, picks the=item, and waits for the filter bar's Clear to enable.Verified locally
CellFilterMenuBuilderTests,CellFilterStateTests,CellFilterApplyTests,ColumnTypeSQLQuotingTests,HighlightRuleDescriptionTests,HighlightRuleSetTests,MainContentCoordinatorTabSwitchTests,FilterMoveTests,FilterRestoreTests,StructureRowMenuRouteTests,QuickHighlightOrderingTests,FilterPersistenceRoundTripTests,CoordinatorColumnVisibilityTests).CellFilterMenuUITestspasses.HighlightRulesUITests, which drives the same cell menu, passed its cell-menu case;testChangingARulesColumnKeepsTheColumnItWasGivenfailed once inside the suite on a menu-item lookup in the rules popover and passed on its own. That popover is not touched here.