feat(datagrid): fill column with one value across loaded rows (#1304)#1398
Merged
Conversation
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.
What
Adds a Fill Column action to the data grid. Right-click a column header, choose Fill Column, enter one value (or check Set to NULL), and it sets that value across all loaded rows. Closes #1304.
The change is staged like any other cell edit, so you review it (Preview SQL), Save to apply, or Discard. One
Cmd+Zreverts the whole fill.Scope decision
Fill targets the rows currently loaded in the grid, not every row matching the current filter. This is deliberate:
UPDATE ... WHERE <filter>would bypass change-tracking and undo entirely.Because the fill is staged and reversible before Save, there is no blocking confirmation alert. The dialog states the impact inline ("This sets N loaded rows. Review and Save to apply.").
How it works
TableViewCoordinator(the existingNSMenuDelegate), so the whole flow is coordinator-local like Copy Column Values and multi-cell paste.NSAlertwith an accessory view (text field, plus a "Set to NULL" checkbox on nullable columns), the same pattern as the existing column-rename prompt.beginUndoGrouping/endUndoGroupingnamed "Fill Column", loopingcommitTypedCellEditover loaded rows.Guards
isEditable).Unique-constraint columns aren't guarded yet (that metadata isn't reachable synchronously at menu-build time); PK is the worst case and is covered. Noted as a follow-up.
Tests
FillColumnTestscovers the decision logic: fills all loaded rows, skips deleted rows, none when read-only, none when empty, NULL vs empty-string resolution, and singular/plural impact text. The apply loop reusescommitTypedCellEdit, which the cell-edit and paste paths already exercise.Docs / CHANGELOG
docs/features/data-grid.mdx.Addedentry under[Unreleased].New
String(localized:)keys are extracted intoLocalizable.xcstringson build.Not included (deliberate)