Edit dialog in React Scheduler.
A live React example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 44 jqxScheduler demos for React.
appointmentDataFields property – Sets or gets the appointments data fields.disabled property – Sets or gets whether the Scheduler is disabled.date property – Sets or gets the Scheduler's Date.editDialogOpen propertyeditDialogCreate propertyeditDialogKeyDown propertyeditDialogClose propertyheight property – Sets or gets the Scheduler's height.resources property – Sets or gets the Scheduler's resource object.showLegend property – Sets or gets whether the Scheduler's legend bar is displayed.source property – Sets or gets the Scheduler appointments data source.theme property – Sets the widget's theme.views property – Sets or gets the Scheduler's views.view property – Sets or gets the Scheduler's view.width property – Sets or gets the Scheduler's width.To run it in your own app, install the package with npm install jqwidgets-scripts, add these files to a Vite React and TypeScript project, and import jqx.base.css and a theme in main.tsx. Getting started with jqxScheduler shows the setup step by step.
import { useRef, useMemo, useCallback } from 'react';
import { flushSync } from 'react-dom';
import { createRoot } from 'react-dom/client';
import JqxButton from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbuttons';
import JqxScheduler, { type ISchedulerProps, jqx } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxscheduler';
interface Appointment {
calendar: string;
description: string;
end: Date;
id: string;
location: string;
start: Date;
subject: string;
}
interface SchedulerFields {
repeatContainer: { hide: () => void };
statusContainer: { hide: () => void };
timeZoneContainer: { hide: () => void };
colorContainer: { hide: () => void };
subjectLabel: { html: (text: string) => void };
locationLabel: { html: (text: string) => void };
fromLabel: { html: (text: string) => void };
toLabel: { html: (text: string) => void };
resourceLabel: { html: (text: string) => void };
buttons: HTMLElement[];
subject: { val: () => string };
from: { val: () => string };
to: { val: () => string };
location: { val: () => string };
resource: { val: () => string };
}
type EditDialogFunction = (
dialog: HTMLElement,
fields: SchedulerFields,
editAppointment: boolean
) => void;
type EditDialogKeyDownFunction = (
dialog: HTMLElement,
fields: SchedulerFields,
editAppointment: boolean,
event: KeyboardEvent
) => boolean;
function App() {
const myScheduler = useRef<JqxScheduler>(null);
const printButton = useRef<JqxButton>(null);
const appointments = useMemo<Appointment[]>(() => [
{
calendar: "East Coast Events",
description: "George brings projector for presentations.",
end: new Date(2026, 10, 14, 16, 0, 0),
id: "id1",
location: "",
start: new Date(2026, 10, 11, 9, 0, 0),
subject: "Fashion Expo"
},
{
calendar: "Middle West Events",
description: "",
end: new Date(2026, 10, 18, 15, 0, 0),
id: "id2",
location: "",
start: new Date(2026, 10, 16, 10, 0, 0),
subject: "Cloud Data Expo"
},
{
calendar: "West Coast Events",
description: "",
end: new Date(2026, 10, 24, 13, 0, 0),
id: "id3",
location: "",
start: new Date(2026, 10, 19, 11, 0, 0),
subject: "Digital Media Conference"
},
{
calendar: "West Coast Events",
description: "",
end: new Date(2026, 10, 8, 18, 0, 0),
id: "id4",
location: "",
start: new Date(2026, 10, 6, 16, 0, 0),
subject: "Modern Software Development Conference"
},
{
calendar: "Middle West Events",
description: "",
end: new Date(2026, 10, 2, 17, 0, 0),
id: "id5",
location: "",
start: new Date(2026, 10, 1, 15, 0, 0),
subject: "Marketing Future Expo"
},
{
calendar: "East Coast Events",
description: "",
end: new Date(2026, 10, 16, 16, 0, 0),
id: "id6",
location: "",
start: new Date(2026, 10, 9, 14, 0, 0),
subject: "Future Computing"
}
], []);
const source = useMemo(() => ({
dataFields: [
{ name: 'id', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'location', type: 'string' },
{ name: 'subject', type: 'string' },
{ name: 'calendar', type: 'string' },
{ name: 'start', type: 'date' },
{ name: 'end', type: 'date' }
],
dataType: "array",
id: 'id',
localData: appointments
}), [appointments]);
const dataAdapter = useMemo(() => new jqx.dataAdapter(source), [source]);
const appointmentDataFields = useMemo<ISchedulerProps['appointmentDataFields']>(() => ({
description: "description",
from: "start",
id: "id",
location: "location",
resourceId: "calendar",
subject: "subject",
to: "end"
}), []);
const resources = useMemo(() => ({
colorScheme: "scheme01",
dataField: "calendar",
source: new jqx.dataAdapter(source)
}), [source]);
const views = useMemo<ISchedulerProps['views']>(() => [
'dayView',
'weekView',
'monthView'
], []);
const editDialogCreate = useCallback<EditDialogFunction>((_dialog, fields, _editAppointment) => {
fields.repeatContainer.hide();
fields.statusContainer.hide();
fields.timeZoneContainer.hide();
fields.colorContainer.hide();
fields.subjectLabel.html("Title");
fields.locationLabel.html("Where");
fields.fromLabel.html("Start");
fields.toLabel.html("End");
fields.resourceLabel.html("Calendar");
const buttonContainer = document.createElement("div");
buttonContainer.style.cssFloat = 'right';
buttonContainer.style.marginLeft = '5px';
fields.buttons[0].appendChild(buttonContainer);
const printingFunction = () => {
const appointmentContent =
"<table class='printTable'>" +
"<tr>" +
"<td class='label'>Title</td>" +
"<td>" + fields.subject.val() + "</td>" +
"</tr>" +
"<tr>" +
"<td class='label'>Start</td>" +
"<td>" + fields.from.val() + "</td>" +
"</tr>" +
"<tr>" +
"<td class='label'>End</td>" +
"<td>" + fields.to.val() + "</td>" +
"</tr>" +
"<tr>" +
"<td class='label'>Where</td>" +
"<td>" + fields.location.val() + "</td>" +
"</tr>" +
"<tr>" +
"<td class='label'>Calendar</td>" +
"<td>" + fields.resource.val() + "</td>" +
"</tr>"
+ "</table>";
const newWindow = window.open("", "", "width=800, height=500");
if (!newWindow) return;
const documentObj = newWindow.document.open();
const pageContent =
'<!DOCTYPE html>\n' +
'<html>\n' +
'<head>\n' +
'<meta charset="utf-8" />\n' +
'<title>jQWidgets Scheduler</title>\n' +
'<style>\n' +
'.printTable {\n' +
'border-color: #aaa;\n' +
'}\n' +
'.printTable .label {\n' +
'font-weight: bold;\n' +
'}\n' +
'.printTable td{\n' +
'padding: 4px 3px;\n' +
'border: 1px solid #DDD;\n' +
'vertical-align: top;\n' +
'}\n' +
'</style>' +
'</head>\n' +
'<body>\n' + appointmentContent + '\n</body>\n</html>';
try {
documentObj.write(pageContent);
documentObj.close();
} catch {
// ignore
}
newWindow.print();
};
const printBtn = (
<JqxButton
theme="tailwind-blue-dark"
ref={printButton}
onClick={printingFunction}
width={40}
height={16}
>
Print
</JqxButton>
);
// Rendered synchronously, so that editDialogOpen, which runs next, finds the button.
flushSync(() => {
createRoot(buttonContainer).render(printBtn);
});
}, []);
const editDialogOpen = useCallback<EditDialogFunction>((_dialog, _fields, editAppointment) => {
if (printButton.current) {
printButton.current.setOptions({ disabled: !editAppointment });
}
}, []);
const editDialogClose = useCallback<EditDialogFunction>(() => {}, []);
const editDialogKeyDown = useCallback<EditDialogKeyDownFunction>(() => {
return false;
}, []);
return (
<JqxScheduler
theme="tailwind-blue-dark"
ref={myScheduler}
width="100%"
height={600}
date={new jqx.date(2026, 11, 19)}
source={dataAdapter}
showLegend={true}
editDialogCreate={editDialogCreate}
editDialogOpen={editDialogOpen}
editDialogClose={editDialogClose}
editDialogKeyDown={editDialogKeyDown}
resources={resources}
view="monthView"
views={views}
appointmentDataFields={appointmentDataFields}
/>
);
}
export default App;