Documentation
This tutorial makes jqxGrid editable: text, a drop-down list, a number input with validation, a date picker and a checkbox. The grid keeps the edited data; the page keeps a list of what changed, shows it, and hands it to a save function.

Set up a page as in Bind the jQuery Grid to data. Editing needs jqxgrid.edit.js, and each editor needs its widget: jqxlistbox.js and jqxdropdownlist.js for the drop-down list, jqxnumberinput.js for numbers, jqxcalendar.js and jqxdatetimeinput.js for dates, jqxcheckbox.js for the checkbox:
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcore.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdata.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxbuttons.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxscrollbar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcheckbox.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxlistbox.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdropdownlist.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxnumberinput.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcalendar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdatetimeinput.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.selection.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.edit.js"></script>
editable turns editing on. editmode: 'dblclick' starts an edit with a double click (the default is a click on a selected cell), and selectionmode: 'singlecell' selects cells rather than rows, which suits editing. Enter or a click elsewhere ends the edit and keeps the value; Esc cancels it. A checkbox cell changes with a single click.
grid.jqxGrid({
theme: 'fluent',
width: '100%',
autoheight: true,
source,
columns,
editable: true,
editmode: 'dblclick',
selectionmode: 'singlecell'
});
A column's columntype picks its editor: dropdownlist, numberinput, datetimeinput, checkbox, or a text box by default. createeditor runs when the editor is created and receives the editor as a $-wrapped element, so it can set the widget's own options, such as the list of departments. editable: false keeps a column read only.
Two hooks check values:
validation receives the new value. Returning true accepts it; returning { result: false, message } keeps the editor open with the message next to it, until the value is valid or the user cancels. The salary column uses it.cellvaluechanging runs when an edit ends and returns the value to store. The name column trims the text, and returns the old value when the new one is empty, which cancels the change.const columns = [
{
text: 'Name', datafield: 'name', width: 190,
// A rule that needs the value as text: checked when the edit ends.
cellvaluechanging: (row, datafield, columntype, oldvalue, newvalue) => {
// Returning the old value cancels the change.
return String(newvalue).trim() === '' ? oldvalue : String(newvalue).trim();
}
},
{
text: 'Department', datafield: 'department', width: 150, columntype: 'dropdownlist',
createeditor: (row, value, editor) => {
editor.jqxDropDownList({ source: departments, autoDropDownHeight: true });
}
},
{
text: 'Salary', datafield: 'salary', width: 130, columntype: 'numberinput', cellsformat: 'c0', cellsalign: 'right', align: 'right',
// The value stays in the editor and the message shows until it is valid.
validation: (cell, value) => {
if (value === undefined || value < 20000 || value > 300000) {
return { result: false, message: 'Enter a salary between 20,000 and 300,000.' };
}
return true;
},
createeditor: (row, value, editor) => {
editor.jqxNumberInput({ decimalDigits: 0, digits: 6, spinButtons: true });
}
},
{ text: 'Start date', datafield: 'startDate', width: 150, columntype: 'datetimeinput', cellsformat: 'yyyy-MM-dd' },
{ text: 'Remote', datafield: 'remote', columntype: 'checkbox', width: 80 },
// Read only: the id is not editable.
{ text: 'Id', datafield: 'id', width: 60, editable: false }
];
The grid raises cellvaluechanged after each accepted edit. Its details are in event.args: the row index, the field, and the old and new values. getrowid turns the row index into the row's id. The handler adds the change to a list and draws the list again:
// The grid keeps the edited data; the page keeps a list of what changed, for saving.
const changes = [];
const list = document.getElementById('changes');
const saveButton = document.getElementById('save');
const show = (value) => (value instanceof Date ? value.toLocaleDateString('en-CA') : String(value));
function renderChanges() {
// textContent, not innerHTML: an edited value is shown as text, whatever it contains.
list.replaceChildren(...changes.map((c) => {
const item = document.createElement('li');
item.textContent = `Employee ${c.id}: ${c.field} ${show(c.oldValue)} → ${show(c.newValue)}`;
return item;
}));
document.getElementById('changeCount').textContent = changes.length;
saveButton.disabled = changes.length === 0;
}
grid.on('cellvaluechanged', (event) => {
const { rowindex, datafield, oldvalue, newvalue } = event.args;
const id = Number(grid.jqxGrid('getrowid', rowindex));
changes.push({ id, field: datafield, oldValue: oldvalue, newValue: newvalue });
renderChanges();
});
The list is built from elements with textContent, never from HTML strings, so a value such as <b>Janet</b> appears as typed. The grid's own cells are different: they write a value into the page as HTML, also in columns without a renderer. For columns where users type text, add the escaping renderer shown in Custom cell rendering.
To save, getrows returns the grid's current rows, edits included. The example sends only the rows that changed, and clears the list once they are saved.
saveButton.addEventListener('click', () => {
const changedIds = new Set(changes.map((c) => c.id));
const payload = grid.jqxGrid('getrows').filter((row) => changedIds.has(row.id));
// Send payload to your server here, for example with fetch('/api/employees', { method: 'PUT', ... }).
console.log('Saving', payload);
changes.length = 0;
renderChanges();
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Employees</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/styles/jqx.fluent.css">
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcore.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdata.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxbuttons.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxscrollbar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcheckbox.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxlistbox.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdropdownlist.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxnumberinput.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcalendar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdatetimeinput.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.selection.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.edit.js"></script>
</head>
<body>
<main style="padding: 16px;">
<h1>Employees</h1>
<p>Double-click a cell to edit it. Enter or a click outside saves the cell; Esc cancels.</p>
<div id="grid"></div>
<h2>Unsaved changes: <span id="changeCount">0</span></h2>
<ul id="changes"></ul>
<button id="save" type="button" disabled>Save changes</button>
</main>
<script type="module">
const departments = ['Engineering', 'Finance', 'Marketing', 'Sales', 'Support'];
const employees = [
{ id: 1, name: 'Nancy Davolio', department: 'Sales', salary: 58000, startDate: new Date(2026, 0, 12), remote: false },
{ id: 2, name: 'Andrew Fuller', department: 'Sales', salary: 92000, startDate: new Date(2026, 1, 2), remote: true },
{ id: 3, name: 'Janet Leverling', department: 'Marketing', salary: 61000, startDate: new Date(2026, 2, 16), remote: true },
{ id: 4, name: 'Margaret Peacock', department: 'Finance', salary: 67000, startDate: new Date(2026, 4, 4), remote: false },
{ id: 5, name: 'Steven Buchanan', department: 'Engineering', salary: 88000, startDate: new Date(2026, 6, 1), remote: true },
{ id: 6, name: 'Michael Suyama', department: 'Support', salary: 49000, startDate: new Date(2026, 8, 14), remote: false }
];
const source = new $.jqx.dataAdapter({
localdata: employees,
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'name', type: 'string' },
{ name: 'department', type: 'string' },
{ name: 'salary', type: 'number' },
{ name: 'startDate', type: 'date' },
{ name: 'remote', type: 'bool' }
]
});
const columns = [
{
text: 'Name', datafield: 'name', width: 190,
// A rule that needs the value as text: checked when the edit ends.
cellvaluechanging: (row, datafield, columntype, oldvalue, newvalue) => {
// Returning the old value cancels the change.
return String(newvalue).trim() === '' ? oldvalue : String(newvalue).trim();
}
},
{
text: 'Department', datafield: 'department', width: 150, columntype: 'dropdownlist',
createeditor: (row, value, editor) => {
editor.jqxDropDownList({ source: departments, autoDropDownHeight: true });
}
},
{
text: 'Salary', datafield: 'salary', width: 130, columntype: 'numberinput', cellsformat: 'c0', cellsalign: 'right', align: 'right',
// The value stays in the editor and the message shows until it is valid.
validation: (cell, value) => {
if (value === undefined || value < 20000 || value > 300000) {
return { result: false, message: 'Enter a salary between 20,000 and 300,000.' };
}
return true;
},
createeditor: (row, value, editor) => {
editor.jqxNumberInput({ decimalDigits: 0, digits: 6, spinButtons: true });
}
},
{ text: 'Start date', datafield: 'startDate', width: 150, columntype: 'datetimeinput', cellsformat: 'yyyy-MM-dd' },
{ text: 'Remote', datafield: 'remote', columntype: 'checkbox', width: 80 },
// Read only: the id is not editable.
{ text: 'Id', datafield: 'id', width: 60, editable: false }
];
const grid = $('#grid');
grid.jqxGrid({
theme: 'fluent',
width: '100%',
autoheight: true,
source,
columns,
editable: true,
editmode: 'dblclick',
selectionmode: 'singlecell'
});
// The grid keeps the edited data; the page keeps a list of what changed, for saving.
const changes = [];
const list = document.getElementById('changes');
const saveButton = document.getElementById('save');
const show = (value) => (value instanceof Date ? value.toLocaleDateString('en-CA') : String(value));
function renderChanges() {
// textContent, not innerHTML: an edited value is shown as text, whatever it contains.
list.replaceChildren(...changes.map((c) => {
const item = document.createElement('li');
item.textContent = `Employee ${c.id}: ${c.field} ${show(c.oldValue)} → ${show(c.newValue)}`;
return item;
}));
document.getElementById('changeCount').textContent = changes.length;
saveButton.disabled = changes.length === 0;
}
grid.on('cellvaluechanged', (event) => {
const { rowindex, datafield, oldvalue, newvalue } = event.args;
const id = Number(grid.jqxGrid('getrowid', rowindex));
changes.push({ id, field: datafield, oldValue: oldvalue, newValue: newvalue });
renderChanges();
});
saveButton.addEventListener('click', () => {
const changedIds = new Set(changes.map((c) => c.id));
const payload = grid.jqxGrid('getrows').filter((row) => changedIds.has(row.id));
// Send payload to your server here, for example with fetch('/api/employees', { method: 'PUT', ... }).
console.log('Saving', payload);
changes.length = 0;
renderChanges();
});
</script>
</body>
</html>
Double-click Nancy Davolio's salary and type 5: the message Enter a salary between 20,000 and 300,000. appears and the editor stays open. Type 61000 and press Enter: the cell shows $61,000 and the list reads Employee 1: salary 58000 → 61000. Double-click a start date, open the editor's calendar and pick a day; click a Remote checkbox. Save changes logs the changed rows in the browser console and empties the list.
columns)