Built-in file chooser cell editor
A built-in editor type that opens the native file picker when editing a cell. It reads the chosen file as text, data URL or ArrayBuffer (or does not read it at all) and passes it to a callback that returns the new cell value, either synchronously or as a Promise. The editor supports accept filters, size limits and multiple files, and shows a loading state while reading. Before this, the same result required a fully…
Planned. This page shows the specification from issue #211. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid of 10 documents with columns Name, Attachment (file editor, accept '.csv,.txt', 1 MB limit, readAs 'text'), Line count, and Avatar (file editor, accept 'image/*', readAs 'dataURL').
Expected behavior
Picking a CSV sets Attachment to the file name and Line count from the file contents via the callback. Picking an image shows a thumbnail in Avatar. With slow upload, the cell shows a busy state and blocks a second edit until the callback resolves. Oversized or wrong-type files raise fileEditorError and keep the old value. Cancelling the picker cancels the edit.
Planned API surface
columnDef.editor: 'file'columnDef.fileEditor { accept?: string, multiple?: boolean, maxSizeBytes?: number, readAs?: 'text'|'dataURL'|'arrayBuffer'|'none', onFileSelected(files: File[], ctx: { row, column, readResults, api }) => value | Promise<value> }Events: editBegin, editCancel, editCommit, fileEditorError { reason: 'tooLarge'|'readFailed'|'rejected'|'callbackFailed', file }Acceptance criteria
- Editor opens the native picker on edit start from mouse and keyboard (pending)
- Cancelling the picker fires editCancel and leaves the value unchanged (pending)
- readAs modes produce the correct readResults; 'none' skips reading (pending)
- Promise results commit on resolve and cancel the edit on reject, with an error event (pending)
- maxSizeBytes and accept are enforced in code, not only by the picker (pending)
- Works with undo/redo and change tracking like other editors (pending)