Vue UI Components 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; Vue keeps a list of what changed, shows it, and hands it to a save function.

Use a Vite and Vue 3 app set up as in Add a Grid to a Vue 3 app, and read the section on constant props in Sorting, filtering and paging from Vue: recording a change updates a ref of the component, and the grid must not re-render when it does.
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; Esc cancels it.
<template>
<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>
<!-- Every prop is a constant: recording a change re-renders this component, not the grid,
which would otherwise bind its source again and show the old values. -->
<JqxGrid
ref="grid"
width="100%"
:autoheight="true"
theme="material-purple"
:source="source"
:columns="columns"
:editable="true"
editmode="dblclick"
selectionmode="singlecell"
@cellvaluechanged="onCellValueChanged"
/>
<h2>Unsaved changes: {{ changes.length }}</h2>
<ul>
<li v-for="(c, i) in changes" :key="i">Employee {{ c.id }}: {{ c.field }} {{ String(c.oldValue) }} → {{ String(c.newValue) }}</li>
</ul>
<button type="button" :disabled="changes.length === 0" @click="save">Save changes</button>
</main>
</template>
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 jQWidgets editor, so it can set the editor'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 under it, until the value is valid or the user cancels. The salary column uses it.cellvaluechanging runs after an edit and can change the value that is stored. 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: number, _datafield: string, _columntype: string, oldvalue: unknown, newvalue: unknown) => {
// 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: number, _value: unknown, editor: any) => {
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: unknown, value: number | undefined) => {
if (value === undefined || value < 20000 || value > 300000) {
return { result: false, message: 'Enter a salary between 20,000 and 300,000.' };
}
return true;
},
createeditor: (_row: number, _value: unknown, editor: any) => {
editor.jqxNumberInput({ decimalDigits: 0, digits: 6, spinButtons: true });
}
},
{ text: 'Start date', datafield: 'startDate', width: 130, 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, and the component listens with @cellvaluechanged. The details are in event.args: the row index, the field, and the old and new values. The handler adds them to a list in a ref. It does not put the edited rows back into the grid's source: the grid already shows them, and binding again would only redraw what is there.
// The grid keeps the edited data; Vue keeps the list of what changed, for saving.
function onCellValueChanged({ args }: CellValueChangedEvent) {
const id = Number(grid.value?.getrowid(args.rowindex));
changes.value.push({ id, field: args.datafield, oldValue: args.oldvalue, newValue: args.newvalue });
}
The list re-renders the component after every edit. JqxGrid's props are all constants, so the grid itself is not re-rendered and keeps the edited values. With a prop that changed, the Grid component of versions before jqwidgets-scripts 27.1.0 would apply all its props again: the grid would bind source again, lose the edits and stay on Loading..., as Bind the Vue Grid to data explains. 27.1.0 applies only the props whose value changed.
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.
function save() {
const rows = grid.value?.getrows() ?? [];
const changedIds = new Set(changes.value.map((c) => c.id));
const payload = rows.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.value = [];
}
<script setup lang="ts">
import { ref } from 'vue';
import JqxGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue';
// Defined globally by the jQWidgets core, which the Grid component imports.
declare const jqx: any;
interface Employee {
id: number;
name: string;
department: string;
salary: number;
startDate: Date;
remote: boolean;
}
interface Change {
id: number;
field: string;
oldValue: unknown;
newValue: unknown;
}
// A grid event carries its details in event.args.
interface CellValueChangedEvent {
args: { rowindex: number; datafield: string; oldvalue: unknown; newvalue: unknown };
}
// The grid methods this component calls.
interface GridMethods {
getrowid: (rowindex: number) => number | string;
getrows: () => Employee[];
}
const departments = ['Engineering', 'Finance', 'Marketing', 'Sales', 'Support'];
const employees: Employee[] = [
{ id: 1, name: 'Nancy Davolio', department: 'Sales', salary: 58000, startDate: new Date(2023, 3, 29), remote: false },
{ id: 2, name: 'Andrew Fuller', department: 'Sales', salary: 92000, startDate: new Date(2021, 7, 11), remote: true },
{ id: 3, name: 'Janet Leverling', department: 'Marketing', salary: 61000, startDate: new Date(2024, 2, 29), remote: true },
{ id: 4, name: 'Margaret Peacock', department: 'Finance', salary: 67000, startDate: new Date(2022, 4, 1), remote: false },
{ id: 5, name: 'Steven Buchanan', department: 'Engineering', salary: 88000, startDate: new Date(2025, 9, 14), remote: true },
{ id: 6, name: 'Michael Suyama', department: 'Support', salary: 49000, startDate: new Date(2026, 9, 15), 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: number, _datafield: string, _columntype: string, oldvalue: unknown, newvalue: unknown) => {
// 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: number, _value: unknown, editor: any) => {
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: unknown, value: number | undefined) => {
if (value === undefined || value < 20000 || value > 300000) {
return { result: false, message: 'Enter a salary between 20,000 and 300,000.' };
}
return true;
},
createeditor: (_row: number, _value: unknown, editor: any) => {
editor.jqxNumberInput({ decimalDigits: 0, digits: 6, spinButtons: true });
}
},
{ text: 'Start date', datafield: 'startDate', width: 130, 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 = ref<GridMethods | null>(null);
const changes = ref<Change[]>([]);
// The grid keeps the edited data; Vue keeps the list of what changed, for saving.
function onCellValueChanged({ args }: CellValueChangedEvent) {
const id = Number(grid.value?.getrowid(args.rowindex));
changes.value.push({ id, field: args.datafield, oldValue: args.oldvalue, newValue: args.newvalue });
}
function save() {
const rows = grid.value?.getrows() ?? [];
const changedIds = new Set(changes.value.map((c) => c.id));
const payload = rows.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.value = [];
}
</script>
<template>
<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>
<!-- Every prop is a constant: recording a change re-renders this component, not the grid,
which would otherwise bind its source again and show the old values. -->
<JqxGrid
ref="grid"
width="100%"
:autoheight="true"
theme="material-purple"
:source="source"
:columns="columns"
:editable="true"
editmode="dblclick"
selectionmode="singlecell"
@cellvaluechanged="onCellValueChanged"
/>
<h2>Unsaved changes: {{ changes.length }}</h2>
<ul>
<li v-for="(c, i) in changes" :key="i">Employee {{ c.id }}: {{ c.field }} {{ String(c.oldValue) }} → {{ String(c.newValue) }}</li>
</ul>
<button type="button" :disabled="changes.length === 0" @click="save">Save changes</button>
</main>
</template>
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 change appears in the list. Save changes logs the changed rows and empties the list.
columns)