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:
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.
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.
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
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"
Context
Neo.grid.Container#toCsv()is the only code that reads a grid's cells as values. Epic#20667names 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'sexportRenderer, 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:
toCsv()and parse the text back, which has lost the types: a number, aDateand their text forms are one string;Neither can read a part of the grid: three records, or the two columns a user selected.
The Architectural Reality
lockedStartColumns,centerColumnsandlockedEndColumnsare 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 adataField(:1790).Neo.grid.column.Base#getRecordValue(record)(src/grid/column/Base.mjs:336) reads aNeo.data.Recordthroughrecord.get()and a plain Turbo Mode row throughNeo.ns, dotted paths included.toCsv()repeats that read inline (:1817).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.toCsv()readsstore.items. ANeo.data.TreeStorekeeps only the visible projection there (src/data/TreeStore.mjs:23), so a reader that wants every node has to pass its own records.hidden: truein 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, andtoCsv()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:get dataFields()returns thedataFieldof 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 mapvalues[row][column]back to a column, or slice the part it needs.getCellValues({dataFields, mode, records})returns one array per record with one value perdataField, both in the order given.dataFieldsdefaults tothis.dataFields,recordstothis.store.items, andmodeto'export'.'export': the column'sexportRenderer({record, value})when it has one, else the record's value.undefinedbecomesnull, and an object or array that is not aDatebecomes its JSON text. A serializer therefore formats only strings, numbers, booleans, dates andnull.'raw': whatgetRecordValue(record)returns, untouched.toCsv()serializesgetCellValues(). 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 oftoCsv().Contract Ledger
Neo.grid.Container#dataFields(new getter)dataFieldof every column that has one, in display order: locked start, center, locked enddataFieldis left outNeo.grid.Container#getCellValues(options)(new)#20667values[row][column]forrecords×dataFields, in the order given;modeis'export'or'raw'as abovedataFieldno column carries yieldsundefined(raw) ornull(export) at its position; any othermodethrowsNeo.grid.Container#toCsv(options)(existing,src/grid/Container.mjs:1788)#20380test/playwright/unit/grid/ToCsv.spec.mjsandtest/playwright/e2e/grid/GridExportCsvNL.spec.mjspass unmodifiedNeo.grid.column.Base#exportRenderer(existing,src/grid/column/Base.mjs:79)#20380exportmodeTwo inputs that no spec covers change in
toCsv(), because the object rule now runs before the serializer. An object whosetoJSON()returnsundefinedexports as an empty field instead of the textundefined. A boxed negativeNumberobject gets the formula guard's leading quote.Decision Record impact
none.
Acceptance Criteria
grid.dataFieldslists the columns that have adataFieldin 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).exportmode appliesexportRenderer, turnsundefinedintonulland an object or array into its JSON text, and leaves a number a number and aDateaDate(unit).rawmode returns the record's value untouched, an object by identity, and ignoresexportRenderer(unit).modethrows, and an unknowndataFieldyieldsundefinedornullat its position (unit).ToCsv.spec.mjsandGridExportCsvNL.spec.mjspass without a change to either file.toCsv()no longer reads a record or appliesexportRendereritself.Out of Scope
displaymode 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.toCsv()includes it today, and the rule belongs to a column visibility API the grid does not have yet.recordstakes records.Neo.selection.grid.BaseModel#dataFields(src/selection/grid/BaseModel.mjs:69), which reads the collection's order.Avoided Traps
toCsv(). Two readers diverge on the first change to the export rule.toCsv()'s text. It has already dropped the types.includeHiddenoption. It would name a state the grid has no API for.Related
Parent: #20667 · Related: #20380 (
toCsv()andexportRenderer)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_memorieson 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"