Context
A grid's rows often need to leave the app, most often into a spreadsheet. Neo's grid has no export. An app that wants one has to rebuild the column order, read each value itself and handle CSV quoting.
The Problem
Nothing in the engine turns a grid's rows into CSV, and nothing on the main thread saves generated text as a file. The second gap matters because the grid lives in the app worker, and a worker can't start a file download.
The Architectural Reality
- No export exists: a grep for
csv, createObjectURL and .download = over src, apps and examples finds nothing.
- A cell's value is
record.get(dataField) (src/grid/Row.mjs l.169), so dotted paths resolve the way the grid reads them. A renderer can return markup or vdom, so a rendered cell is not a CSV value.
createColumns (src/grid/Container.mjs l.954) splits the columns into lockedStartColumns, centerColumns and lockedEndColumns.
- The store holds the filtered and sorted records. A buffered grid renders only a window of them, but the store has every loaded record.
Neo.main.addon.FileSystemAccess (src/main/addon/FileSystemAccess.mjs) gives the app worker the File System Access pickers. They are Chromium-only, and none of them saves a string.
The Fix
Neo.grid.Container#toCsv(options) returns a String. The header line holds each column's text, and every record in the store's current order becomes one line. Columns run in display order: start, center, end. A cell's value is record.get(dataField). If the column defines exportRenderer({record, value}), its return value is used instead. Dates are written as ISO 8601; null and undefined become empty fields.
- Quoting follows RFC 4180. A field that contains the delimiter, a double quote, CR or LF is wrapped in double quotes, with inner quotes doubled. Lines end in CRLF.
- A formula guard, on by default. A string cell starting with
=, +, -, @, a tab or CR gets a leading ', so a spreadsheet doesn't execute it (OWASP "CSV Injection"). Numbers are never prefixed. toCsv({escapeFormulas: false}) turns the guard off.
Neo.grid.Container#exportCsv({fileName}) builds the string with toCsv and passes it to the main thread.
- A main-thread save. A remote method takes
{content, fileName, mimeType}, builds a Blob and clicks an anchor that carries download. This works in every browser and needs no picker. Whether it lives in a new small addon or in FileSystemAccess is the structural pre-flight's call at intake.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
Neo.grid.Container#toCsv(options) |
new |
CSV of the store's current records over the columns in display order |
— |
JSDoc with an example |
unit: order, quoting, guard, dotted fields |
grid.column.Base exportRenderer |
new, optional |
its return value replaces record.get(dataField) |
absent: the raw value |
JSDoc |
unit |
Neo.grid.Container#exportCsv(options) |
new |
saves the output of toCsv as fileName |
— |
JSDoc |
e2e: the downloaded file's content |
| main-thread text save |
new remote method |
a Blob and an anchor with download |
— |
JSDoc |
covered by the e2e above |
Decision Record impact
none.
Acceptance Criteria
Out of Scope
- Excel (
.xlsx) export.
- Loading a remote store's unloaded pages before an export.
- Exporting only the selection, and exporting the group header row of #20379.
Avoided Traps
- Exporting rendered cells. A renderer may return markup or vdom built for display, so the visible text can't be recovered reliably.
exportRenderer is the explicit place for a column whose value needs formatting.
- Exporting the rendered rows. A buffered grid renders only a window, so the store's records are the data.
- Depending on the File System Access picker. It is Chromium-only, while a Blob download works everywhere.
Related
- #20359: grid column types that read
record[dataField] miss a nested dataField. The export reads through record.get, so it doesn't share that gap.
- #20379: grouped column headers.
Live latest-open + closed sweep: checked the latest 20 open issues (#20167–#20377) and the closed search "export csv" at 2026-11-05T19:44Z. No equivalent ticket or prior exclusion found; the closed hits are unrelated tooling. The A2A sweep of the last 30 messages shows no claim on this scope. Memory Core holds no prior decision on it, and none of my open assignments covers it.
Owner: @neo-opus-grace, self-assigned at creation, with a delivery date, so it isn't offered as a first issue.
Origin Session ID: 620212f1-fddf-4d36-89f6-34cbc3a124cf
Retrieval Hint: "grid CSV export toCsv exportCsv main thread file download"
Context
A grid's rows often need to leave the app, most often into a spreadsheet. Neo's grid has no export. An app that wants one has to rebuild the column order, read each value itself and handle CSV quoting.
The Problem
Nothing in the engine turns a grid's rows into CSV, and nothing on the main thread saves generated text as a file. The second gap matters because the grid lives in the app worker, and a worker can't start a file download.
The Architectural Reality
csv,createObjectURLand.download =oversrc,appsandexamplesfinds nothing.record.get(dataField)(src/grid/Row.mjsl.169), so dotted paths resolve the way the grid reads them. A renderer can return markup or vdom, so a rendered cell is not a CSV value.createColumns(src/grid/Container.mjsl.954) splits the columns intolockedStartColumns,centerColumnsandlockedEndColumns.Neo.main.addon.FileSystemAccess(src/main/addon/FileSystemAccess.mjs) gives the app worker the File System Access pickers. They are Chromium-only, and none of them saves a string.The Fix
Neo.grid.Container#toCsv(options)returns a String. The header line holds each column'stext, and every record in the store's current order becomes one line. Columns run in display order: start, center, end. A cell's value isrecord.get(dataField). If the column definesexportRenderer({record, value}), its return value is used instead. Dates are written as ISO 8601;nullandundefinedbecome empty fields.=,+,-,@, a tab or CR gets a leading', so a spreadsheet doesn't execute it (OWASP "CSV Injection"). Numbers are never prefixed.toCsv({escapeFormulas: false})turns the guard off.Neo.grid.Container#exportCsv({fileName})builds the string withtoCsvand passes it to the main thread.{content, fileName, mimeType}, builds a Blob and clicks an anchor that carriesdownload. This works in every browser and needs no picker. Whether it lives in a new small addon or inFileSystemAccessis the structural pre-flight's call at intake.Contract Ledger
Neo.grid.Container#toCsv(options)grid.column.BaseexportRendererrecord.get(dataField)Neo.grid.Container#exportCsv(options)toCsvasfileNamedownloadDecision Record impact
none.
Acceptance Criteria
toCsv()on a grid with locked-start, center and locked-end columns writes them in display order, after the header line (unit).=,+,-or@gets a leading', and a number is never prefixed (unit).dataFieldexports the valuerecord.getresolves for it, andexportRendereroverrides that value (unit).exportCsv({fileName: 'rows.csv'})downloads a file namedrows.csvwhose content equalstoCsv()(e2e).Out of Scope
.xlsx) export.Avoided Traps
exportRendereris the explicit place for a column whose value needs formatting.Related
record[dataField]miss a nesteddataField. The export reads throughrecord.get, so it doesn't share that gap.Live latest-open + closed sweep: checked the latest 20 open issues (#20167–#20377) and the closed search "export csv" at 2026-11-05T19:44Z. No equivalent ticket or prior exclusion found; the closed hits are unrelated tooling. The A2A sweep of the last 30 messages shows no claim on this scope. Memory Core holds no prior decision on it, and none of my open assignments covers it.
Owner: @neo-opus-grace, self-assigned at creation, with a delivery date, so it isn't offered as a first issue.
Origin Session ID: 620212f1-fddf-4d36-89f6-34cbc3a124cf
Retrieval Hint: "grid CSV export toCsv exportCsv main thread file download"