Skip to content

feat(datagrid): fill column with one value across loaded rows (#1304)#1398

Merged
datlechin merged 2 commits into
mainfrom
feat/1304-fill-column
May 23, 2026
Merged

feat(datagrid): fill column with one value across loaded rows (#1304)#1398
datlechin merged 2 commits into
mainfrom
feat/1304-fill-column

Conversation

@datlechin
Copy link
Copy Markdown
Member

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+Z reverts the whole fill.

Scope decision

Fill targets the rows currently loaded in the grid, not every row matching the current filter. This is deliberate:

  • The issue scopes it to "the current result set or view."
  • No mature native client (TablePlus, DataGrip, Postico, Sequel) offers a whole-table grid fill. They all stay selection/loaded-scoped and staged, to avoid accidental mass updates of unseen rows.
  • A whole-table 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

  • Menu item lives in the column-header context menu, between Copy Column Values and Filter. Built by TableViewCoordinator (the existing NSMenuDelegate), so the whole flow is coordinator-local like Copy Column Values and multi-cell paste.
  • Dialog is an NSAlert with an accessory view (text field, plus a "Set to NULL" checkbox on nullable columns), the same pattern as the existing column-rename prompt.
  • Apply reuses the multi-cell-paste mechanics: one beginUndoGrouping/endUndoGrouping named "Fill Column", looping commitTypedCellEdit over loaded rows.

Guards

  • Hidden on read-only result sets (isEditable).
  • Hidden on primary key columns (filling a PK with one value would fail with a duplicate-key error on Save; DataGrip disables it for the same reason).
  • No-op when no rows are loaded.
  • Already-equal values skip via the existing cell-commit guard.

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

FillColumnTests covers 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 reuses commitTypedCellEdit, which the cell-edit and paste paths already exercise.

Docs / CHANGELOG

  • New Fill Column subsection in docs/features/data-grid.mdx.
  • Added entry under [Unreleased].

New String(localized:) keys are extracted into Localizable.xcstrings on build.

Not included (deliberate)

  • No whole-table / all-filtered-rows server-side UPDATE.
  • No keyboard shortcut (contextual action).
  • No selection-scoped "Set value" on arbitrary cell selections (separate feature).

@datlechin datlechin merged commit b87d161 into main May 23, 2026
2 checks passed
@datlechin datlechin deleted the feat/1304-fill-column branch May 23, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Edit Column for all rows in data

1 participant