All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

DevExtreme jQuery - 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 that allows choosing 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 option.

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
    ],
    // ...
})

To prevent a user from updating an appointment, set the editing.allowUpdating option 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
    ],
    // ...
})

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, 4, 25, 9, 00),
        endDate: new Date(2016, 4, 25, 9, 30)
    }, 
    // ...
    ];

    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, 4, 25, 9, 0),
        endDate: new Date(2016, 4, 25, 9, 30)
    }, 
    // ...
    ];
    currentDate = new Date(2016, 4, 25);

    updateAppointment() {
        this.scheduler.instance.updateAppointment(this.appointments[0], { text: "Planning" } );
    }
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule,
        DxButtonModule
    ],
    // ...
})

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 widget, assign it to the corresponding onEventName option when you configure the widget.

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
    ],
    // ...
})

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. This approach is more typical of jQuery.

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