Hi Cliff,
Thank you for contacting Syncfusion support.
Please find the following responses for your queries.
We have prepared the sample for all your requirements which can be download from the following location:
Query1: I would like to enable/disable editing of appointments based on roles or permissions. I can make the schedule read only. However, when clicking an appointment, the "quick" appointment window displays the "edit appointment" link. Double clicking the appointment brings up the edit window.
In the above sample we have disabled the Edit Appointment and Edit Series link when the Scheduler is in readOnly mode. We have added one field named isAdmin to data base, which is used to set the modification rights, based on which the CRUD operations are performed on the appointments. For example, if isAdmin field is set to false, only then the appointment operations such as drag and drop, resizing or editing of those appointment will be allowed for the users. Kindly refer the following code example used in the above sample.
<Code>
function onBeforeAppointmentCreate(args) {
// Here add the previlage to appointment while saving new appointment
args.appointment["isAdmin"] = false;
}
//This method to handle dragging and resizing of the appointments
function onDragandResizeStart(args) {
if (!ej.isNullOrUndefined(args.appointment) && args.appointment.isAdmin) {
args.cancel = true;
}
}
//This method to handle deleting the appointments
function onBeforeAppointmentRemove(args) {
if (!ej.isNullOrUndefined(args.appointment) && args.appointment.isAdmin) {
args.cancel = true;
}
}
//This method to handle editing the appointments
function onAppointmentWindowOpen(args) {
if ((!ej.isNullOrUndefined(args.appointment) && args.appointment.isAdmin) || this.model.readOnly) {
args.cancel = true;
}
}
//This method to disable the edit appointment and edit series link
function onQuickWindowOpen(args) {
var obj = $("#Schedule1").data("ejSchedule");
if (this.model.readOnly) {
obj._quickAppDetailsWindow.find('.e-editevent,.e-editseries,.e-scheduledelete ').addClass("e-userinter");
}
}
</Code>
Query2: Is there a way to add extra fields in the default appointment editor? Such as I need to add a dropdownlist that would associate a category with the appointment.
By enabling CategorizeSettings option we can have a default category dropdown list box in appointment window. Kindly refer the below online sample and UG link to know more about the Categorize option.
We recommend you to avail the default custom window option to customize the default appointment window. Kindly refer to the following online sample and UG link to know more about the custom window option.
Query3: When printing an appointment from a context menu, can some fields be excluded from the print out? I don't need recurrence, recurrenceid, apptaskid, guid.
By default, we have excluded the Recurrenceid, Apptaskid, Guid internally at our end. To exclude the Recurrence field we have overridden the function _printAppointment at sample side. Kindly refer to the following code example used in the above sample.
<Code>
ej.Schedule.prototype._printAppointment= function (appointment) { //here we are overriding the default print function to exclude the fields
var $element = ej.buildTag("div"), templist;
if (typeof appointment === 'object')
templist = appointment;
---------
---------
var exclude = ["Guid", "ParentId", "RecurrenceId", "RecurrenceExDate", "AppTaskId", "Recurrence", "isAdmin"]; //exclusion array list
$.each(templist, function (i, val) {
if ((exclude.indexOf(i) == -1) && !ej.isNullOrUndefined(val) && !ej.isNullOrUndefined(i) && i != "null") {
if (i == proxy._appointmentSettings.startTime || i == proxy._appointmentSettings.endTime)
val = val;
appointmentTable += "<tr style='height:30px'><td style='width:300px'><b>" + i + ":</b></td><td style='width:600px'>" + val + "</td></tr>";
}
});
---------
---------
ej.print($element);
return false;
}
</Code>
Regards,
Karthigeyan