# Full-row editing

The `fullRowEditing` prop puts the WHOLE row into edit at once - every editable cell (text, select, number, date, checkbox) shows an inline editor. Enter or click-away commits all cells in one update; Esc cancels the row.

Uses `@svgrid/grid` (MIT). Category: Editing. Live demo: https://svgrid.com/demos/177-full-row-editing/

Install: `npm i @svgrid/grid` (Svelte 5).

## About this example

Full-row editing in the Svelte 5 data grid: the fullRowEditing prop puts every editable cell of a row into edit at once, with a text, select, number, date or checkbox editor per column. Enter or clicking away commits all cells in one update and Escape cancels the whole row, giving a form-style entry experience at grid density in under a hundred lines.

`fullRowEditing` puts the WHOLE row into edit at once - every editable cell shows an inline editor. Enter (or clicking away) commits all cells in one update; Esc cancels the whole row. A form-style entry experience with the density of a grid.

## Imports, features and API used

- Imports: `@svgrid/grid`
- Table features registered: `rowSortingFeature`
- Columns: `name` (Name), `role` (Role), `department` (Department), `salary` (Salary), `startDate` (Start date), `active` (Active)

## Frequently asked questions

### How do I switch from cell editing to row editing?

Keep enableInlineEditing on and add fullRowEditing. Double-click or F2 then opens editors in every editable cell of that row instead of one cell.

### When are the values written?

All at once when the row commits, on Enter or when focus leaves the row. Escape discards every change in the row. The full-row editor covers the text, number, date, datetime, checkbox and list editor types.

### Can some columns stay read-only in row mode?

Yes. Columns with editable: false or no editorType show their value as text while the rest of the row is in edit.

## Related documentation

- [Full-row editing](https://svgrid.com/docs/help/editing/full-row.md)

## Related articles

- [Undo/Redo for Grid Edits in SvGrid](https://svgrid.com/blog/undo-redo-grid-edits/) - Wire Ctrl+Z and Ctrl+Y into an editable SvGrid in minutes - the history stack is built in, you just need to surface it correctly.
- [Paste from Excel into a Svelte Data Grid](https://svgrid.com/blog/paste-from-excel/) - How to wire up clipboard paste so users can drop a copied Excel or Google Sheets block directly into SvGrid - TSV parsing, type coercion, validation, and row growth all covered.
- [A Fill Handle (Drag to Fill) in SvGrid](https://svgrid.com/blog/fill-handle-drag-to-fill/) - Build a working spreadsheet-style fill handle on top of SvGrid's cell selection and editing - pointer tracking, range highlighting, series fill, and undo/redo integration all covered.

## Source code (177-full-row-editing.svelte)

```svelte
<!-- Documented in: docs/help/editing/full-row.md -->
<script lang="ts">
  /**
   * 177. Full-row editing
   * ---------------------
   * `fullRowEditing` puts the WHOLE row into edit at once - every editable
   * cell shows an inline editor. Enter (or clicking away) commits all cells in
   * one update; Esc cancels the whole row. A form-style entry experience with
   * the density of a grid.
   */
  import {
    SvGrid,
    tableFeatures,
    rowSortingFeature,
    type GridColumns,
  } from '@svgrid/grid'

  type Employee = {
    name: string
    role: string
    department: string
    salary: number
    startDate: string
    active: boolean
  }

  let rows = $state<Employee[]>([
    { name: 'Ada Lovelace', role: 'Staff Engineer', department: 'Engineering', salary: 172000, startDate: '2021-03-01', active: true },
    { name: 'Linus Torvalds', role: 'Architect', department: 'Engineering', salary: 198000, startDate: '2019-07-15', active: true },
    { name: 'Grace Hopper', role: 'VP Product', department: 'Product', salary: 210000, startDate: '2018-01-10', active: true },
    { name: 'Tim Berners-Lee', role: 'Designer', department: 'Design', salary: 148000, startDate: '2022-09-05', active: false },
    { name: 'Margaret Hamilton', role: 'Director', department: 'Operations', salary: 205000, startDate: '2017-04-22', active: true },
  ])

  const features = tableFeatures({ rowSortingFeature })

  const columns: GridColumns<Employee> = [
    { field: 'name', header: 'Name', editorType: 'text', width: 180 },
    { field: 'role', header: 'Role', editorType: 'text', width: 160 },
    {
      field: 'department',
      header: 'Department',
      editorType: 'select',
      width: 150,
      editorOptions: ['Engineering', 'Product', 'Design', 'Operations', 'Sales'],
    },
    {
      field: 'salary',
      header: 'Salary',
      editorType: 'number',
      width: 140,
      align: 'right',
      format: { type: 'currency', currency: 'USD', options: { maximumFractionDigits: 0 } },
    },
    { field: 'startDate', header: 'Start date', editorType: 'date', width: 150, format: { type: 'date', pattern: 'y-m-d' } },
    { field: 'active', header: 'Active', editorType: 'checkbox', width: 90, align: 'center' },
  ]
</script>

<section class="flex flex-col flex-1 min-h-0 gap-3">
  <p class="text-sm shrink-0" style="color: var(--sg-fg);">
    <strong>Double-click any row</strong> - every editable cell turns into an
    inline editor at once (text, select, number, date, checkbox).
    Press <kbd>Enter</kbd> or click away to commit the whole row in one update;
    press <kbd>Esc</kbd> to cancel. This is the <code>fullRowEditing</code> prop.
  </p>

  <div class="flex-1 min-h-0">
    <SvGrid responsive={true}
      columnResize
      data={rows}
      columns={columns}
      features={features}
      showRowNumbers={true}
      enableInlineEditing={true}
      fullRowEditing={true}
      rowHeight={40}
      containerHeight="100%"
      fitColumns={true}
    />
  </div>
</section>
```

[View this example on GitHub](https://github.com/sv-grid/sv-grid/blob/main/examples/src/demos/177-full-row-editing.svelte)
