LearnNewsExamplesServices
Frontmatter
id18707
titleGrid selection models tell rows from cells by string and by ntype
stateClosed
labels
enhancementairefactoringgrid
assigneesneo-opus-grace
createdAtSep 14, 2026, 9:30 PM
updatedAtSep 15, 2026, 12:35 AM
githubUrlhttps://github.com/neomjs/neo/issues/18707
authorneo-opus-grace
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 15, 2026, 12:35 AM

Grid selection models tell rows from cells by string and by ntype

Closed v13.2.0/archive-v13-2-0-chunk-21 enhancementairefactoringgrid
neo-opus-grace
neo-opus-grace commented on Sep 14, 2026, 9:30 PM

Context

Split from #9075 with @tobiu's approval (option A, 2026-09-14). The PR resolving #9075 narrows it to what the intake evidence showed was broken and shippable: column selection that never repainted its cells, the three drifted copies of that logic, and a row or column highlight surviving a model swap-out. This ticket carries #9075's remaining objectives, reshaped by the intake finding, because two of them were prescribed with mechanisms that do not fit the code as it stands.

The Problem

src/selection/grid still tells its item kinds apart by string, and its class hierarchy still forces duplication:

  1. Row versus cell, by string. BaseModel#updateBodyRows decides per item with item.toString().includes('__') (BaseModel.mjs:98): a logical cell id is recordId__dataField, a record id is not. The branch is load-bearing — one CellRowModel instance feeds record ids (selectRow / deselectRow → updateRows(recordId)) and logical cell ids (CellModel#onCellClick → toggleSelection) through the same method. By construction the predicate cannot distinguish a record whose key itself contains __. #9012 already gave rows and cells data-record-id / data-field attributes so selection code need not reverse-engineer ids; this branch predates using them here.
  2. Row-selecting models, by ntype. View#rowSelectionModel (View.mjs:126–129) recognises a row-selecting model by selectionModel?.ntype?.includes('row'), and both the flag adoption and the paint getters read it. #18626 deferred "a declared row-selection trait on the model classes" to #9075.
  3. Duplication the hierarchy forces. After #9075's dedupe, CellColumnModel and CellColumnRowModel still carry two identical overrides (onCellClick, onNavKeyColumn) because they extend different parents (CellModel / CellRowModel). Neo's mixins cannot host them: mixinProperty (Neo.mjs:1184) assigns over the class's own method, and a copied method keeps its home object, so super inside it resolves against the mixin's parent.
  4. internalId versus recordId handling, #9075's fourth objective, written in 2026-02 — before #18661 made the View own the single model. Whether it still applies is unverified.

The Architectural Reality

  • src/selection/grid/BaseModel.mjs — updateRows / updateBodyRows; selectRow / deselectRow / deselectAllRows; select / deselect / deselectAll; and the column half added by #9075's PR (setSelectedColumns, updateColumns, stepSelectedColumn).
  • src/selection/grid/{RowModel,CellModel,CellRowModel,CellColumnModel,CellColumnRowModel,ColumnModel}.mjs.
  • src/grid/View.mjs — rowSelectionModel and its consumers: the flag adoption on store bind/load, and the paint getters.
  • src/grid/Row.mjs — renders row, cell and column selection state from the View's model; grid/Body.mjs#fireCellEvent resolves dataField / record from the data-* attributes.

The Fix

  1. Type the updates where the caller knows the type. The row callers — selectRow, deselectRow, deselectAllRows — always pass record ids. The generic select / deselect / deselectAll pass the model's own items. updateBodyRows stops inspecting strings.
  2. Declare the trait. A row-selecting model says so on its class; View#rowSelectionModel reads that instead of an ntype substring.
  3. Compose the column-selecting Cell* pair without relying on super inside a mixin — or record, with evidence, that two small overrides are the right shape for two parents.
  4. Verify objective 4 at intake against the post-#18661 code; normalize with an arm, or close it out as already done.

Acceptance Criteria

  • AC-1 BaseModel#updateBodyRows inspects no item strings; row and cell repaints are typed at the call site; a record whose key contains __ repaints as a row.
  • AC-2 View#rowSelectionModel reads a declared trait; no ntype substring test remains. The flag-following arms in ViewOwnedSelectionModel.spec.mjs stay green for RowModel, CellRowModel and CellColumnRowModel, and stay off for CellModel and ColumnModel.
  • AC-3 CellColumnModel and CellColumnRowModel carry no duplicated override — or this ticket records why two overrides are the right shape.
  • AC-4 internalId / recordId handling is verified at intake: normalized with an arm, or closed out with the evidence that it already is.
  • AC-5 unit/grid/ColumnSelection.spec.mjs and ViewOwnedSelectionModel.spec.mjs stay green.

Out of Scope

  • Column-selection repaint, the column-logic dedupe, and swap-out repaint — delivered by the PR resolving #9075.
  • Keyboard navigation across split bodies (#9496).
  • Split-row selection for the multi-body grid (#9492).

Related

  • #9075 — the source ticket and its intake finding.
  • #9012 — the split dataset (data-record-id / data-field).
  • #9014 — granular row/cell updates, the precedent #9075's column repaint follows.
  • #18626 / #18661 — the View-owned selection model; where the row-selection trait was deferred.
  • #9492, #9496 — adjacent multi-body selection work.

unowned-rationale: split from #9075 at the operator's request so #9075 can close on what shipped; parked for the next engine-selection lane rather than claimed now.

Live latest-open sweep: latest 20 open issues at 2026-09-14T19:29Z, plus gh issue list --state all --search "rowSelectionModel OR updateBodyRows" (only #9075, #18626, #12758) — no equivalent. A2A in-flight claim sweep: last 30 messages, all read states, at 19:29Z — no claim on grid selection. Own-assignment sweep: nothing overlapping. Semantic sweep: ask_knowledge_base(type='ticket') surfaced #12758, #9012, #9014, #9492 — none owns these objectives. Memory Core: the 2026-02-06 session behind #9014 fixed the cell-selection form of the same repaint gap.

Retrieval Hint: "grid selection models row versus cell id string heuristic, ntype row trait, CellColumnModel CellColumnRowModel duplicated override" Origin Session ID: b43a5b46-c79a-40ce-8eb8-d4eb122f4cd8

tobiu referenced in commit e50b3d9 - "refactor(selection): grid models declare what they select, and a repaint is typed by its caller (#18707) (#18711) on Sep 15, 2026, 12:35 AM
tobiu closed this issue on Sep 15, 2026, 12:35 AM