3 Answers, 1 is accepted
0
Hello Marc,
The Scheduler can be configured so that the user cannot delete events. In order to do this you can call Destroy with a "false" parameter as shown below. By default it is "true" and deletion of events is enabled.
This will have effect for all events. If you want to prevent the deletion only of specific events you can handle the Scheduler's Remove event, in which the event the user is trying to delete is accessible through the arguments, check whether the event fulfills a condition and cancel the deletion. In the following example we prevent the user from deleting an event with a specific title:
Regards,
Ivan Danchev
Telerik
The Scheduler can be configured so that the user cannot delete events. In order to do this you can call Destroy with a "false" parameter as shown below. By default it is "true" and deletion of events is enabled.
.Editable(editable => editable.Destroy(
false
))
This will have effect for all events. If you want to prevent the deletion only of specific events you can handle the Scheduler's Remove event, in which the event the user is trying to delete is accessible through the arguments, check whether the event fulfills a condition and cancel the deletion. In the following example we prevent the user from deleting an event with a specific title:
function
scheduler_remove(e) {
if
(e.event.title ==
"Take the dog to the vet"
) {
e.preventDefault();
}
}
Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 09 Aug 2018, 03:52 PM
Hi,
Unfortunately, scheduler_remove fires after the delete confirmation prompt, which looks really bad ("Do you want to delete this?" "yes?", "well you can't", "no, I don't know why we asked either"...)
As I have a set of events, only some of which are to be deletable, I would like only to have a delete confirmation prompt when delete is actually going to be possible for that specific event. (Or of course, conditional removal of the delete button itself).
Is this possible?
Thanks
0
Hi,
I agree that preventing the event is counter intuitive in the scenario you described. You could consider using a different approach - saving the information about whether an event can or cannot be removed in a field in the event itself. Then you can use template for the event render or not a custom class in the template based on that field value. In the databound event you can find all events that have that class (e.g. "non-removable") and hide their remove button. In addition to the databound event the edit event can be used to hide the Delete button from the Scheduler's Editor, which appears on double-clicking an event.
Here's a dojo example, which demonstrates this approach. The "Meeting" event has the nonRemovable field set to "non-removable". It is added as a class within its template. This allows its remove/Delete buttons to be hidden in mentioned event handlers.
Regards,
Ivan Danchev
Progress Telerik
I agree that preventing the event is counter intuitive in the scenario you described. You could consider using a different approach - saving the information about whether an event can or cannot be removed in a field in the event itself. Then you can use template for the event render or not a custom class in the template based on that field value. In the databound event you can find all events that have that class (e.g. "non-removable") and hide their remove button. In addition to the databound event the edit event can be used to hide the Delete button from the Scheduler's Editor, which appears on double-clicking an event.
Here's a dojo example, which demonstrates this approach. The "Meeting" event has the nonRemovable field set to "non-removable". It is added as a class within its template. This allows its remove/Delete buttons to be hidden in mentioned event handlers.
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.