Inline Editing
Double-click any cell or press Enter when focused to edit its value. DataGrid supports text, number, select, and boolean editors out of the box.
💡
Try it out:
- Double click the Name column to edit as text.
- Double click Department for a dropdown select.
- Double click Salary for number input.
- Double click Active to toggle the boolean switch.
ID
Name
Role
Department
Salary
Status
1
Employee 001
User
Sales
₹50,000
Active
2
Employee 002
Editor
HR
₹1,93,000
Inactive
3
Employee 003
Manager
Finance
₹1,38,000
Inactive
4
Employee 004
Viewer
Design
₹46,000
Inactive
5
Employee 005
Admin
Developer
₹1,05,000
Inactive
6
Employee 006
User
Doctor
₹70,000
Active
7
Employee 007
Editor
Lawyer
₹1,26,000
Active
8
Employee 008
Manager
Architect
₹56,000
Inactive
9
Employee 009
Viewer
Engineer
₹1,84,000
Inactive
10
Employee 010
Admin
Teacher
₹96,000
Active
10 Records
tsx
1import { useState } from "react";2import { DataGrid, GridColumn } from "@quartix/grid";3import { SMALL_DATA, currencyFmt } from "@/data";45export default function InlineEditingExample() {6 const [data, setData] = useState(SMALL_DATA);78 const columns: GridColumn[] = [9 { key: "id", header: "ID", width: 60 },10 { key: "name", header: "Name", flex: 1, editable: true },11 {12 key: "department",13 header: "Department",14 width: 150,15 editable: true,16 editorType: "select",17 editorOptions: [18 { label: "Engineering", value: "Engineering" },19 { label: "HR", value: "HR" },20 { label: "Sales", value: "Sales" },21 { label: "Marketing", value: "Marketing" }22 ]23 },24 {25 key: "salary",26 header: "Salary",27 width: 120,28 editable: true,29 editorType: "number",30 formatter: currencyFmt31 },32 {33 key: "active",34 header: "Active",35 width: 100,36 editable: true,37 editorType: "select",38 editorOptions: [{label: "true", value: true}, {label: "false", value: false}],39 formatter: (v) => v ? "Active" : "Inactive"40 }41 ];4243 return (44 <DataGrid45 data={data}46 columns={columns}47 height={300}48 onCellEdit={(params) => {49 const newData = [...data];50 const rowIndex = newData.findIndex(r => String(r.id) === String(params.rowId));51 if (rowIndex > -1) {52 newData[rowIndex] = { ...newData[rowIndex], [params.column.key]: params.newValue };53 setData(newData);54 }55 }}56 />57 );58}