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.


{
  "key": "4f257ae2-e942-46a6-a702-d9fc53089e3c",
  "keyColumn": "Id",
  "table": null,
  "action": "remove",
  "params": {
    "StartDate": "2025-06-30T22:00:00.000Z",
    "EndDate": "2025-07-31T22:00:00.000Z"
  },
  "StartDate": "2025-06-30T22:00:00.000Z",
  "EndDate": "2025-07-31T22:00:00.000Z"
}


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.

      case 'Delete':
        scheduleRef.current.deleteEvent(currentEventObj!);
        break;
      case 'DeleteOccurrence':
      case 'DeleteSeries':
        scheduleRef.current.deleteEvent(currentEventObj!, selectedMenuItem);
        break;
    }

6 Replies

VR Vijay Ravi Syncfusion Team July 23, 2025 12:36 PM UTC

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
 



TP Thomas Pentenrieder July 23, 2025 01:17 PM UTC

I just double checked and I don't see a batch operation when passing the object as array. Am I missing something


Image_6667_1753276590975


Image_2664_1753276618043



VR Vijay Ravi Syncfusion Team July 29, 2025 10:15 AM UTC

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



TP Thomas Pentenrieder July 30, 2025 09:22 AM UTC

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.



VR Vijay Ravi Syncfusion Team July 31, 2025 01:07 PM UTC

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



VR Vijay Ravi Syncfusion Team August 20, 2025 07:46 AM UTC

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


Loader.
Up arrow icon