Preventing "New Event" and reverting card movement when API fails

"Hi Team, I am exploring scheduler component. I have below queries:

1. I also want to stop the user from creating new events when double-click on a empty cell . Which output event will help me block the "New Event" modal from opening up. ?

2. Also, how to revert the card movement when the backend API call fails while moving a event. I have "await" call to backend  API , doing "event.cancel = true" in "catch" block is not helping here
if (event.requestType === 'eventChange') {
      try {
        await this.datastore.delete('delete_old_event'));
        await this.datastore.create('add_new_event'); // <- if this fails
      } catch (e) {
        event.cancel = true;
        console.log('connection error: ', e);
      }


1 Reply

RV Ravikumar Venkatesan Syncfusion Team December 4, 2020 12:56 PM UTC

Hi Shashank, 

Greetings from Syncfusion support. 

Q: I also want to stop the user from creating new events when double-click on a empty cell 
We have validated your above query at our end. We have achieved your requirement with the help of the popupOpen event of the Schedule as shown in the below code, same can be referred in the below sample. 

[app.component.ts] 
  onPopupOpen(args: PopupOpenEventArgs) { 
    args.cancel = args.type === "Editor" && args.target.classList.contains("e-work-cells"); 
  } 

Q: Doing "event.cancel = true" in "catch" block is not helping here 
We have validated your above query based on your shred details at our end. But, we are unable to reproduce the problem at our end and it works as expected. We have prepared a sample for your reference which can be viewed from the following link. Kindly check the below sample and if you still facing the same problem please share the below details to serve you better. 

  • Reproduce the problem in the below-sample or
  • Share a sample that illustrates the problem which would help us to proceed further.



Regards, 
Ravikumar Venkatesan 


Loader.
Up arrow icon