You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,7 +34,7 @@ Main events you need to implement so you can store the appointment information c
33
34
34
35
*`OnCreate` - fires when the user saves a new appointment, including an exception for a recurring appointment.
35
36
*`OnUpdate` - fires when the user changes an existing appointment. Fires for the recurring appointment when an exception has been created for it.
36
-
*`OnDelete` - fires when the user deletes and appointment (including a recurring appointment).
37
+
*`OnDelete` - fires when the user deletes and appointment (including a recurring appointment). You can also enable a [delete confirmation dialog](#delete-confirmation-dialog).
37
38
38
39
There are two other events that you are not required to handle - you can use them to implement application logic:
39
40
@@ -80,8 +81,148 @@ The UI for the scheduler provides the following options for interacting with the
80
81
* An appointment that spans multiple days but is not marked as an all-day appointment shows up in the all-day slot for the days that it spans entirely. The first and last day would render in the day portions to denote the start and end time accurately.
81
82
82
83
84
+
## Delete Confirmation Dialog
83
85
86
+
The delete confirmation dialog triggers before event deletion. You can enable it by setting the `ConfirmDelete` parameter of the Scheduler to `true`. The default texts of the dialog are exposed in the [localization]({%slug globalization-localization%}) messages of the component, and you can customize them.
84
87
88
+
>important This dialog displays only for **single** events, **not** for recurring. The built-in delete confirmation dialog for recurring events is **not** changed.
89
+
90
+
>caption Delete Confirmation dialog appearance
91
+
92
+

93
+
94
+
>caption Enabling of the Delete Confirmation Dialog
95
+
96
+
````CSHTML
97
+
@* Scheduler with enabled Delete Confirmation Dialog *@
public static async Task<List<SchedulerAppointment>> Read()
201
+
{
202
+
return await Task.FromResult(_data);
203
+
}
204
+
205
+
public static async Task Delete(SchedulerAppointment itemToDelete)
206
+
{
207
+
if (itemToDelete.RecurrenceId != null)
208
+
{
209
+
// a recurrence exception was deleted, you may want to update
210
+
// the rest of the data source - find an item where theItem.Id == itemToDelete.RecurrenceId
211
+
// and remove the current exception date from the list of its RecurrenceExceptions
212
+
}
213
+
214
+
if (!string.IsNullOrEmpty(itemToDelete.RecurrenceRule) && itemToDelete.RecurrenceExceptions?.Count > 0)
215
+
{
216
+
// a recurring appointment was deleted that had exceptions, you may want to
217
+
// delete or update any exceptions from the data source - look for
218
+
// items where theItem.RecurrenceId == itemToDelete.Id
219
+
}
220
+
221
+
_data.Remove(itemToDelete);
222
+
}
223
+
}
224
+
}
225
+
````
85
226
## Example
86
227
87
228
The example below shows the signature of the event handlers so you can copy the proper arguments and start implementing your business logic and data storage operations. The example only updates the local collection of appointments used in the UI.
0 commit comments