How can I allow the collision from sweetalert

How can I allow the collision from swal ? .then((result) inside swal is not working.

http://jsfiddle.net/dyra43j8/2/

scheduler.attachEvent("onEventCollision", function (ev, evs){   

  let conflict_result = '';
  
  dont_write = true;
  
    swal({
      title: "Collision",
      html: conflict_result ,
      type: "info",
      showCancelButton: true,
      showConfirmButton: true,
      confirmButtonText: "force write",
    }).then((result) => {
      console.log(result);
      if ((typeof result['value'] !== 'undefined') && result['value']==true) {
        dont_write = false;
        return false;
      } else {

        return true;
      }
    });

    //return false;
    return dont_write;
  }
  
});

Hello @Dalon,

I’m not familiar with the “sweetalert”, but technically it occurs, because there is no good option to "pause the event execution in javascript, so the modal “swal” doesn’t do this, it’s expected behavior.

Looks like the thing that you have to do, is to add an event manually on then “ok” button callback. I’m not ok with this library, and can’t provide a ready solution for it, but you can read about a similar problem(with our modal box) by the following link:

Here is a demo with an example of the solution(hope it will work with the “swal” the same as with our modal box(drag event to the different section to check how it works):
http://snippet.dhtmlx.com/5/fca22f33c

Kind regards,

1 Like