LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 9, 2026, 11:40 PM
updatedAtNov 10, 2026, 12:20 AM
githubUrlhttps://github.com/neomjs/neo/issues/20672
authorneo-opus-vega
commentsCount0
parentIssue20667
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 10, 2026, 12:20 AM
milestonev13.5

Read a grid's cells as values for any set of records and columns

Closed v14.0.0/archive-v14-0-0-chunk-1 enhancementaigrid
neo-opus-vega
neo-opus-vega commented on Nov 9, 2026, 11:40 PM

Context

Neo.grid.Container#toCsv() is the only code that reads a grid's cells as values. Epic #20667 names the gap: a package outside this repository that copies cells to the clipboard, writes a spreadsheet file or lets an agent read what a user sees cannot get those values from the grid, so it would walk the records itself.

The Problem

The walk is private to one serializer. toCsv() decides which columns hold a value, reads each record and applies the column's exportRenderer, all inline (src/grid/Container.mjs:1788-1824), and always for every record of the store and every column.

A second reader has two options today, and both are wrong:

  • call toCsv() and parse the text back, which has lost the types: a number, a Date and their text forms are one string;
  • repeat the walk, after which two readers disagree on a cell's value as soon as one of them changes.

Neither can read a part of the grid: three records, or the two columns a user selected.

The Architectural Reality

  • Columns. lockedStartColumns, centerColumns and lockedEndColumns are the grid's region and index oracle (refreshRegionColumns(), src/grid/Container.mjs:1407), refreshed on every column mutation. Concatenated, they are the display order. toCsv() keeps the columns that have a dataField (:1790).
  • Reading a record. Neo.grid.column.Base#getRecordValue(record) (src/grid/column/Base.mjs:336) reads a Neo.data.Record through record.get() and a plain Turbo Mode row through Neo.ns, dotted paths included. toCsv() repeats that read inline (:1817).
  • The export rule. exportRenderer({record, value}) replaces the record's value (:1819). The serializer then turns an object into its JSON text (:1800-1801), which is a rule about the value, not about CSV.
  • Rows. toCsv() reads store.items. A Neo.data.TreeStore keeps only the visible projection there (src/data/TreeStore.mjs:23), so a reader that wants every node has to pass its own records.
  • Hidden columns. The grid has no column visibility API. hidden: true in a column's config reaches its header button (src/grid/Container.mjs:1022), whose position then gets a width of 0 (src/grid/header/Toolbar.mjs:444). No grid example or grid spec sets it, and toCsv() exports such a column.

Design authority: n/a — calls no existing behavior wrong; toCsv() keeps its signature and its output.

The Fix

In src/grid/Container.mjs:

  1. get dataFields() returns the dataField of every column that has one, in display order: locked start, center, locked end. It names the columns the walk reads by default, so a caller can map values[row][column] back to a column, or slice the part it needs.
  2. getCellValues({dataFields, mode, records}) returns one array per record with one value per dataField, both in the order given. dataFields defaults to this.dataFields, records to this.store.items, and mode to 'export'.
    • 'export': the column's exportRenderer({record, value}) when it has one, else the record's value. undefined becomes null, and an object or array that is not a Date becomes its JSON text. A serializer therefore formats only strings, numbers, booleans, dates and null.
    • 'raw': what getRecordValue(record) returns, untouched.
  3. toCsv() serializes getCellValues(). Its inline walk, its copy of the record read and its object branch go.

exportRenderer's JSDoc (src/grid/column/Base.mjs:74) names the walk instead of toCsv().

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.grid.Container#dataFields (new getter) this ticket the dataField of every column that has one, in display order: locked start, center, locked end a column without a dataField is left out JSDoc unit: the order across the three regions
Neo.grid.Container#getCellValues(options) (new) this ticket, under epic #20667 values[row][column] for records × dataFields, in the order given; mode is 'export' or 'raw' as above a dataField no column carries yields undefined (raw) or null (export) at its position; any other mode throws JSDoc with an example unit: both modes, a subset and a reorder of records and columns, a plain row, both fallbacks
Neo.grid.Container#toCsv(options) (existing, src/grid/Container.mjs:1788) #20380 unchanged signature and output — JSDoc names the walk test/playwright/unit/grid/ToCsv.spec.mjs and test/playwright/e2e/grid/GridExportCsvNL.spec.mjs pass unmodified
Neo.grid.column.Base#exportRenderer (existing, src/grid/column/Base.mjs:79) #20380 unchanged: its return value replaces the record's value, now inside the walk's export mode absent: the record's value JSDoc names the walk unit

Two inputs that no spec covers change in toCsv(), because the object rule now runs before the serializer. An object whose toJSON() returns undefined exports as an empty field instead of the text undefined. A boxed negative Number object gets the formula guard's leading quote.

Decision Record impact

none.

Acceptance Criteria

  • grid.dataFields lists the columns that have a dataField in display order across the three regions (unit).
  • getCellValues() returns every record in the store's current order × grid.dataFields (unit).
  • getCellValues({dataFields, records}) reads exactly the records and columns given, in the order given, including a record the store's filter hides and a plain row object (unit).
  • export mode applies exportRenderer, turns undefined into null and an object or array into its JSON text, and leaves a number a number and a Date a Date (unit).
  • raw mode returns the record's value untouched, an object by identity, and ignores exportRenderer (unit).
  • An unknown mode throws, and an unknown dataField yields undefined or null at its position (unit).
  • ToCsv.spec.mjs and GridExportCsvNL.spec.mjs pass without a change to either file.
  • toCsv() no longer reads a record or applies exportRenderer itself.

Out of Scope

  • A display mode that yields the text a user reads in the cell. A renderer may return markup or vdom (#20380, Avoided Traps), so that mode needs a leaf of its own.
  • Leaving out a column whose header is hidden. toCsv() includes it today, and the rule belongs to a column visibility API the grid does not have yet.
  • Selecting a range of cells, a clipboard and a spreadsheet writer. They are consumers of this walk.
  • Naming rows by id or index, for a caller that holds no records. records takes records.
  • Neo.selection.grid.BaseModel#dataFields (src/selection/grid/BaseModel.mjs:69), which reads the collection's order.

Avoided Traps

  • A second walk beside toCsv(). Two readers diverge on the first change to the export rule.
  • Parsing toCsv()'s text. It has already dropped the types.
  • Formatting in a consumer. If the walk yielded objects, every serializer would pick its own text for them.
  • Rows by rendered index. A buffered grid pools its rows, so an index names a different record after a scroll.
  • An includeHidden option. It would name a state the grid has no API for.

Related

Parent: #20667 · Related: #20380 (toCsv() and exportRenderer)

Live latest-open + closed sweep: checked all 9 open issues plus closed searches (cell values; toCsv; clipboard; export grid values; range selection; Out of Scope / Avoided Traps read on #20380) at 2026-11-09T22:37Z; no equivalent or prior exclusion found. Backlog: 9 open, green band. A2A in-flight claim sweep: latest 30 messages, all read-states; no competing claim. MC sweep: query_raw_memories on the symptom (readers outside the grid disagree on a cell's value: CSV, clipboard, spreadsheet), 6 results, no conflicting decision found. Own-assignment sweep: 1 open (#20667, the parent), none overlapping.

Owner: self-assigned at creation with a delivery date (2026-11-11), so it is not offered as a first issue.

Origin Session ID: ddec8e0d-a792-49a7-af4a-5e6f297f1d3f

Retrieval Hint: "cell-value walk getCellValues toCsv serializer", "export mode yields scalars", "grid dataFields display order"

tobiu referenced in commit 6ba8c6c - "feat(grid): read a grid's cells as values for any records and columns (#20672) (#20674) on Nov 10, 2026, 12:20 AM
tobiu closed this issue on Nov 10, 2026, 12:20 AM