We are happy to hear from you.
As said earlier there is no default option to alert the user on request fail. We have performed the CRUD operation on Ajax post to alert the user which can be download from the below location.
<Code>
beforeAppointmentCreate: "onCRUDActions",
beforeAppointmentChange: "onCRUDActions",
beforeAppointmentRemove: "onCRUDActions"
function onCRUDActions(args) {
args.cancel = true; var UserData;
if (args.currentAction == "add" || args.type == "beforeAppointmentCreate") {
var appoint = [];
appoint[0] = !(ej.isNullOrUndefined(args.appointment[0])) ? args.appointment[0] : args.appointment;
UserData = { "added": appoint, "changed": null, "removed": null };
}
else if (args.currentAction == "edit" || args.currentAction == "editSeries") {
var appoint = [];
if (args.currentAction == "editSeries") {
var app = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.changed[0].ParentId));
for (var i = 0 ; i < app.length ; i++) {
if (app[i][this._appointmentSettings["recurrenceRule"]].indexOf("RECUREDITID") != -1) {
appoint.push(app[i]);
}
}
}
UserData = { "added": null, "changed": args.appointment.changed, "removed": (appoint.length > 0) ? appoint : null };
}
else if (args.currentAction == "delete" || args.currentAction == "deleteSeries") {
var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.ParentId));
UserData = { "added": null, "changed": null, "removed": appoint };
}
else if (args.currentAction == "editOccurrence") {
var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.changed[0].ParentId));
args.appointment.changed[0]["Recurrence"] = true;
UserData = { "added": args.appointment.changed, "changed": appoint, "removed": null };
}
else if (args.currentAction == "deleteOccurrence") {
var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.ParentId));
UserData = { "added": null, "changed": appoint, "removed": null };
}
$.ajax({
url: '/Home/CRUD/',
data: JSON.stringify(UserData),
type: 'POST',
traditional: true,
contentType: 'application/json',
success: function (data) {
if (data.status && data.status != "") {
var obj = $("#Schedule1").data("ejSchedule");
obj.refreshAppointments();
alert(data.status);
}
},
failure: function (data) {
alert("Failure occurred")
},
error: function (data) {
alert("Error Occurred")
}
});
}
</Code>
Regards,
Karthigeyan