Skip to content

feat(datagrid): support column and cell-range selection #1446

Closed

Description

@shouwang0527

Problem

The data grid currently only supports row-level selection (selectedRowIndices: Set<Int>). There is no way to visually select an entire column or a vertical range of cells within a column.

Common scenarios where this is needed:

  • Copy a subset of values from one column (e.g., rows 5–20 of an id column) to paste into a WHERE clause or another tool
  • Select a column to perform bulk operations (delete column values, batch edit, export just that column)
  • Quick comparison: select the same column in two query results side by side

Current workarounds

  • Right-click column header → "Copy Column Values" copies the entire column, but there's no visual selection and no way to copy a partial range
  • Selecting individual cells one by one isn't possible — only full rows can be multi-selected

Proposed behavior

  1. Click column header → select (highlight) the entire column; Cmd+C copies all values
  2. Click a cell, then Shift-click another cell in the same column → select the vertical range between them
  3. Cmd-click cells → add/remove individual cells to the selection (non-contiguous)
  4. Selected cells should have a visual highlight, and Cmd+C should copy the selected values (newline-separated or configurable)

Implementation notes (for context)

The current selection model is row-based (Set<Int> at DataGridView.swift:42). Supporting cell selection would likely require a richer model, e.g., Set<CellIndex> where CellIndex = (row: Int, column: Int), plus updates to:

  • SortableHeaderView (header click → select instead of / in addition to sort)
  • KeyHandlingTableView (Shift/Cmd-click routing)
  • DataGridCoordinator (selection sync)

This is similar to how Excel, DataGrip, and DBeaver handle column/range selection in their data grids.

Activity

  1. added
    enhancement
    on May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions