- Home
- Forum
- React - EJ 2
- delteEvent not called as batch action
delteEvent not called as batch action
I've implemented the context menu as described here, and everything is working well except the Delete Event.
The issue is, that this is the only call (except for GET) that currently does not send a batch action but a remove action to the server.
I'm using the DataManager with a URLAdaptor where every modifying action is sent to the server as a batch action.
Can I somehow change this call to force it being a batch action as well instead of writing custom handling on the backend side for this? I tried sending this as an array but that didn't change anything. Interestingly, DeleteOccurrence and DeleteSeries are sent as batch and work just fine.
Hi Thomas Pentenrieder,
We have reviewed and
validated your query regarding the implementation of a batch action for the
deleteEvent method in the React Schedule component when using a DataManager
with a URLAdaptor.To address your requirement, it is indeed possible to
configure the deleteEvent action, triggered from the context menu, to send a
batch action to the server instead of a single remove action. This aligns the
behavior with that of DeleteOccurrence and DeleteSeries, which already utilize
batch actions.The solution involves passing an array of event objects to the
deleteEvent method. This approach ensures that the DataManager processes the
deletion as a batch operation, consistent with the handling of recurring event
deletions.
|
const handleContextMenu = (selectedMenuItem) => { const currentEventObj = scheduleRef.current.getCurrentEvent(); switch (selectedMenuItem) { case 'Delete': // Pass the event object as an array to trigger batch action scheduleRef.current.deleteEvent([currentEventObj]); break; case 'DeleteOccurrence': case 'DeleteSeries': scheduleRef.current.deleteEvent(currentEventObj, selectedMenuItem); break; default: break; } }; |
Don't hesitate to get in touch if you require further help or more
information.
Regards,
Vijay
I just double checked and I don't see a batch operation when passing the object as array. Am I missing something
Hi Thomas
Pentenrieder,
We have
thoroughly reviewed and validated your query. To address your concern regarding
the deletion of events using the context menu in the Syncfusion Schedule
component, we have prepared both client-side and server-side sample
implementations. These samples include modifications to handle the delete case
effectively. Refer the below shared corrected code snippet and sample
implementation below.
[index.js]
|
case 'Delete': // Create the EditParams object that matches your controller's expectations const editParams = { action: "batch", added: [], // Initialize as empty arrays, not null changed: [], deleted: [eventObj], value: null };
// Direct approach using fetch to ensure proper format fetch('http://localhost:54738/Home/UpdateData', { method: 'POST', headers: { 'Content-Type': 'application/json', 'RequestVerificationToken': document.querySelector('input[name="__RequestVerificationToken"]')?.value // Include anti-forgery token if needed }, body: JSON.stringify(editParams) }) .then(response => response.json()) .then(data => { // Refresh the scheduler after successful deletion scheduleObj.current.refreshEvents(); }) .catch(error => console.error('Error deleting event:', error)); break; |
client Sample link: https://stackblitz.com/edit/sgtpwdmd-rwzxeezl?file=index.js
Server sample link: https://www.syncfusion.com/downloads/support/forum/170725/ze/ScheduleCRUD1166139915
Don't
hesitate to get in touch if you require further help or more information.
Regards,
Vijay
hm, this seems to be a lot of workaround code with creating a new http client, managing tokens etc. just to have an additional way to delete an appointment.
Could you please track this inconsistent behavior in regards to the DataManager as Feedback so this might become fixed?
For now I'll handle this case on the server side.
Hi Thomas
Pentenrieder,
We consider your reported query with "Issue occurs in param action while deleting event using deleteEvent method" as a bug and logged the defect report. The fix for this defect will be included in our upcoming weekly patch release, which is expected to be rolled out by the August 12, 2025. You can track the status of the fix at the following link:
Feedback link: Issue occurs in param action while deleting event using deleteEvent method in React | Feedback Portal
Disclaimer:
Inclusion of this solution in the weekly release may change due to other
factors including but not limited to QA checks and works reprioritization.
Regards,
Vijay
Hi Thomas,
To meet the requirement of receiving the action parameter at the backend as a
batch, you must call the deleteEvent method with the second parameter, currentAction,
set to "Delete," as shown in the code snippet below. Please
refer to the provided sample for your reference.
|
const onMenuItemSelect = (args) => { let selectedMenuItem = args.item.id; switch (selectedMenuItem) { case 'Delete': // Pass the currentAction parameter to the deleteEvent method to receive the action as batch at the server end. scheduleObj.current.deleteEvent(eventObj, selectedMenuItem); break; } }; |
client Sample link: 7annmjur (duplicated) - StackBlitz
Regards,
Vijay
- 6 Replies
- 2 Participants
-
TP Thomas Pentenrieder
- Jul 22, 2025 01:26 PM UTC
- Aug 20, 2025 07:46 AM UTC