All docs
V24.1
24.2
24.1
23.2
23.1
22.2
22.1
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.

JavaScript/jQuery Scheduler - Update Appointments

User Interaction

An end user can update an appointment in one of the following ways.

  • Reschedule an appointment by moving it to another cell.
  • Extend or shorten an appointment by dragging its top or bottom border.
  • Change the appointment details by focusing the appointment and clicking "Open Appointment" afterwards.

When a user finishes updates, they are saved to the dataSource.

If a user updates a recurring appointment, the Scheduler displays a dialog where users can choose between editing the current appointment and editing the entire series of recurring appointments. If you do not want this dialog to appear, choose the edit mode beforehand using the recurrenceEditMode property.

jQuery
$(function() {
    $("#schedulerContainer").dxScheduler({ 
        // ...
        recurrenceEditMode: 'occurrence' // or 'series' | 'dialog'
    });
});
Angular
HTML
TypeScript
<dx-scheduler ...
    recurrenceEditMode="occurrence"> <!-- or 'series' | 'dialog' -->
</dx-scheduler>
import { DxSchedulerModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule
    ],
    // ...
})
Vue
<template>
    <DxScheduler
        recurrence-edit-mode="occurrence" /> <!-- or 'series' | 'dialog' -->
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import { DxScheduler } from 'devextreme-vue/scheduler';

export default {
    components: {
        DxScheduler
    }
}
</script>
React
import React from 'react';
import 'devextreme/dist/css/dx.light.css';

import { Scheduler } from 'devextreme-react/scheduler';

class App extends React.Component {
    render() {
        return (
            <Scheduler
                recurrenceEditMode="occurrence" /> {/* or 'series' | 'dialog' */}
        );
    }
}

export default App;

To prevent a user from updating an appointment, set the editing.allowUpdating property to false.

jQuery
JavaScript
$(function() {
    $("#schedulerContainer").dxScheduler({ 
        // ...
        editing: { allowUpdating: false }
    });
});
Angular
HTML
TypeScript
<dx-scheduler ... >
    <dxo-editing [allowUpdating]="false"></dxo-editing>
</dx-scheduler>
import { DxSchedulerModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule
    ],
    // ...
})
Vue
<template>
    <DxScheduler
        <DxEditing
            :allow-updating="false" />
    /DxScheduler> 
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import { DxScheduler, DxEditing } from 'devextreme-vue/scheduler';

export default {
    components: {
        DxScheduler
    }
}
</script>
React
import React from 'react';
import 'devextreme/dist/css/dx.light.css';

import { Scheduler, Editing } from 'devextreme-react/scheduler';

class App extends React.Component {
    render() {
        return (
            <Scheduler ... >
                <Editing
                    allowUpdating={false} />
            </Scheduler>
        );
    }
}

export default App;

API

To update an appointment, call the updateAppointment(target, appointment) method. This method updates the target appointment from the data source with the fields of the appointment parameter.

jQuery
JavaScript
$(function() {
    var appointments = [{
        text: "Website Re-Design Plan",
        startDate: new Date("2016-04-25T09:00:00.000Z"),
        endDate: new Date("2016-04-25T09:30:00.000Z")
    }, 
    // ...
    ];

    var scheduler = $("#schedulerContainer").dxScheduler({
        dataSource: appointments,
        currentDate: new Date(2016, 4, 25)
    }).dxScheduler("instance");

    $("#modifyButton").dxButton({
        text: "Modify",
        onClick: function () {
            scheduler.updateAppointment(appointments[0], { text: "Planning" } );
        }
    });
});
Angular
HTML
TypeScript
<dx-scheduler
    [(dataSource)]="appointments"
    [currentDate]="currentDate">
</dx-scheduler>

<dx-button
    text="Update"
    (onClick)="updateAppointment()">
</dx-button>
import { ..., ViewChild } from "@angular/core";
import { DxButtonModule, DxSchedulerModule, DxSchedulerComponent } from "devextreme-angular";
// ...
export class AppComponent  {
    @ViewChild(DxSchedulerComponent, { static: false }) scheduler: DxSchedulerComponent;
    // Prior to Angular 8
    // @ViewChild(DxSchedulerComponent) scheduler: DxSchedulerComponent;
    appointments = [{
        text: "Website Re-Design Plan",
        startDate: new Date("2016-04-25T09:00:00.000Z"),
        endDate: new Date("2016-04-25T09:30:00.000Z")
    }, 
    // ...
    ];
    currentDate = new Date(2016, 4, 25);

    updateAppointment() {
        this.scheduler.instance.updateAppointment(this.appointments[0], { text: "Planning" } );
    }
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule,
        DxButtonModule
    ],
    // ...
})
Vue
App.vue
<template>
    <div>
        <DxScheduler
            ref="scheduler"
            :data-source="appointments"
            :current-date="currentDate"
        />
        <DxButton
            text="Update"
            @click="updateAppointment"
        />
    </div>
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxScheduler from 'devextreme-vue/scheduler';
import DxButton from 'devextreme-vue/button';

export default {
    components: {
        DxScheduler,
        DxButton
    },
    data() {
        return {
            appointments: [{
                text: "Website Re-Design Plan",
                startDate: new Date("2016-04-25T09:00:00.000Z"),
                endDate: new Date("2016-04-25T09:30:00.000Z")
            }, 
            // ...
            ],
            currentDate: new Date(2016, 4, 25)
        },
        methods: {
            updateAppointment(e) {
                this.$refs['scheduler'].instance.updateAppointment(this.appointments[0], { text: "Planning" });
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.light.css';

import Scheduler from 'devextreme-react/scheduler';
import Button from 'devextreme-react/button';

const appointments = [{
    text: "Website Re-Design Plan",
    startDate: new Date("2016-04-25T09:00:00.000Z"),
    endDate: new Date("2016-04-25T09:30:00.000Z")
}, 
// ...
];

class App extends React.Component {
    constructor(props) {
        super(props);
        this.schedulerRef = React.createRef();
        this.updateAppointment = this.updateAppointment.bind(this);
    }

    get scheduler() {
        return this.schedulerRef.current.instance();
    }

    updateAppointment() {
        this.scheduler.updateAppointment(this.appointments[0], { text: "Planning" });
    }

    render() {
        return (
            <React.Fragment>
                <Scheduler
                    dataSource={appointments}
                    defaultCurrentDate={new Date(2016, 4, 25)}
                />
                <Button
                    text="Update"
                    onClick={updateAppointment}
                />
            </React.Fragment>
        );
    }
} 
export default App;

Events

To execute certain commands before or after an appointment was updated, handle the appointmentUpdating or appointmentUpdated event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the corresponding onEventName property when you configure the UI component.

jQuery
JavaScript
$(function () {
    $("#schedulerContainer").dxScheduler({
        // ...
        onAppointmentUpdating: function (e) {
            // Handler of the "appointmentUpdating" event
        },
        onAppointmentUpdated: function (e) {
            // Handler of the "appointmentUpdated" event
        }
    });
});
Angular
HTML
TypeScript
<dx-scheduler ...
    (onAppointmentUpdating)="onAppointmentUpdating($event)"
    (onAppointmentUpdated)="onAppointmentUpdated($event)">
</dx-scheduler>
import { DxSchedulerModule } from "devextreme-angular";
// ...
export class AppComponent {
    onAppointmentUpdating (e) {
        // Handler of the "appointmentUpdating" event
    }

    onAppointmentUpdated (e) {
        // Handler of the "appointmentUpdated" event
    }
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxScheduler ...
        @appointment-updating="onAppointmentUpdating"
        @appointment-updated="onAppointmentUpdated"
    />
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxScheduler from 'devextreme-vue/scheduler';

export default {
    components: {
        DxScheduler
    },
    data() {
        return {
            // ...
        },
        methods: {
            onAppointmentUpdating: (e) => {
                // Handler of the "appointmentUpdating" event
            },
            onAppointmentUpdated: (e) => {
                // Handler of the "appointmentUpdated" event
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.light.css';

import Scheduler from 'devextreme-react/scheduler';

const onAppointmentUpdating = (e) => {
    // Handler of the "appointmentUpdating" event
}
const onAppointmentUpdated = (e) => {
    // Handler of the "appointmentUpdated" event
}

class App extends React.Component {
    render() {
        return (
            <Scheduler ...
                onAppointmentUpdating={onAppointmentUpdating}
                onAppointmentUpdated={onAppointmentUpdated}
            />
        );
    }
}
export default App;
jQuery

If you are going to change event handlers at runtime, or if you need to attach several handlers to a single event, subscribe to the events using the on(eventName, eventHandler) method.

JavaScript
var updatedEventHandler1 = function (e) {
    // First handler of the "updated" event
};

var updatedEventHandler2 = function (e) {
    // Second handler of the "updated" event
};

$("#schedulerContainer").dxScheduler("instance")
    .on("appointmentUpdated", updatedEventHandler1)
    .on("appointmentUpdated", updatedEventHandler2);
See Also