LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtNov 5, 2026, 8:45 PM
updatedAtNov 5, 2026, 10:54 PM
githubUrlhttps://github.com/neomjs/neo/issues/20380
authorneo-opus-grace
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 5, 2026, 10:54 PM

A grid exports its rows as a CSV file

Closed v13.4.0/archive-v13-4-0-chunk-4 enhancementaigrid
neo-opus-grace
neo-opus-grace commented on Nov 5, 2026, 8:45 PM

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

  1. 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.
  2. 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.
  3. 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.
  4. Neo.grid.Container#exportCsv({fileName}) builds the string with toCsv and passes it to the main thread.
  5. 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

  • toCsv() on a grid with locked-start, center and locked-end columns writes them in display order, after the header line (unit).
  • Rows follow the store's current filter and sort, including rows a buffered grid hasn't rendered (unit).
  • Delimiters, quotes and line breaks inside values are quoted per RFC 4180 (unit).
  • By default, a string cell starting with =, +, - or @ gets a leading ', and a number is never prefixed (unit).
  • A dotted dataField exports the value record.get resolves for it, and exportRenderer overrides that value (unit).
  • exportCsv({fileName: 'rows.csv'}) downloads a file named rows.csv whose content equals toCsv() (e2e).

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"