Hi Darkhan,
Greetings from Syncfusion support.
Q1: How to disable edit and delete action for the user that didn’t create the event
Step 1: Add custom event field (“User”) and IsReadonly event field to events like below.
{
"Id": 1,
"Subject": "Board Meeting",
"Description": "Meeting to discuss business goal of 2018.",
"StartTime": "2018-07-30T03:30:00.000Z",
"EndTime": "2018-07-30T05:30:00.000Z",
"RoomId": 1,
"User": "IU1",
"IsReadonly": false
}
Step 2: You can disable the event edit and delete action based on the user with the help of eventRendered event with the below code.
onEventRendered(args) {
if (this.changeReadOnly) {
let datas = this.scheduleObj.eventsData;
for (let i = 0; i < datas.length; i++) {
if (datas[i].User === this.currentUser) {
datas[i].IsReadonly = false;
} else {
datas[i].IsReadonly = true;
}
}
this.changeReadOnly = false;
}
}
Q2: How to check slot availability
You can check the slot availability with the help of the isSlotAvailable method in the actionBegin event with below code.
onActionBegin(args) {
let isEventChange = (args.requestType === 'eventChange');
if ((args.requestType === 'eventCreate' && args.data.length > 0) || isEventChange) {
let eventData = (isEventChange) ? args.data : args.data[0];
let eventField = this.scheduleObj.eventFields;
let startDate = eventData[eventField.startTime];
let endDate = eventData[eventField.endTime];
let resourceIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].indexOf(eventData.RoomId);
args.cancel = !this.scheduleObj.isSlotAvailable(startDate, endDate, resourceIndex);
if (args.cancel === true) {
alert('Slot is already occupied');
}
}
}
Kindly try the above sample and get back to us If you would require further assistance.
Regards,
Ravikumar Venkatesan