We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cancel Drag&Drop when awaiting for async operation

Hello !

When I try to cancel the drag&drop directly it works fine but when I have to wait for a service response, the drag&drop is not canceled. Even though the method is correctly waiting for the service response before showing my toast object, the args.cancel = true has no effect.

Is there a way to achieve this ? Or maybe a way to cancel the drag&drop even after a while, outside the event ?

Thank you in advance !

Here is a lite version of my code :

async OnDragStop(args: DragEventArgs) {
    const reponseWatch: SuiviAudit =
      await this.kanbanService.update(
        args.data[0].id
      );
    if (reponseWatch.codeErreur) {
      args.cancel = true;
      this.toast = {
        title: "XXX",
        content: "XXX",
        cssClass: "e-toast-danger",
        icon: "e-error toast-icons",
      };
      this.toastObj.show(this.toast);
  }

2 Replies

VJ Vinitha Jeyakumar Syncfusion Team June 2, 2022 02:47 PM UTC

Hi Julien,


Currently, we are validating your reported query. we will update you the further details in two business days on or before 6th  June 2022.

Regards,
Vinitha


VJ Vinitha Jeyakumar Syncfusion Team June 3, 2022 10:36 AM UTC

Hi Julien,


We have analyzed the reported scenario in our end. The dragStop event will be triggered while drag and drop a card from the Kanban. If it is marked as async and awaiting for a response to complete its execution, meanwhile the drop action will be processed, and the card will be dropped. This is happening while marking dragStop event handler method as async. This will not work as per your requirement. 

And we want to let you know that the dragStop event is a synchronous function, so we cannot handle any asynchronous await operations in the dragStop event.

Please let us know if you require any other assistance from us. 

Regards,
Vinitha

Loader.
Up arrow icon