0

I'm trying to show a Popover Confirmation when an fc-event is resized or dropped somewhere, but I'm not able to get the target element out of the jsEvent object.

This is what I came up to, when an event is triggered (drop or resize):

function dropHandler( event, delta, revertFunc, jsEvent, ui, view ) {
    $(jsEvent.target).confirmation({
        title: 'Are you sure?',
        container: 'body'
    });
    $(jsEvent.target).confirmation('show');
}

Well, jsEvent.target is not my only try but just the last (unsuccessful) one.

Check the JSFiddle demo for the full code.

Yuri
  • 3,082
  • 3
  • 28
  • 47

1 Answers1

0

since you are using the Bootstrap Confirmation, and since the fullcalendar event have a className, you can set the className as the id of the event when creating the event.but the confirmation dialog will pop up on the old location of the dragged event.

or you can create a div with a specific id to show the confirmation in it.

i'd recommend to use the js usual confirm inside your dropHandler function as follow:

function dropHandler( event, delta, revertFunc, jsEvent, ui, view ) {

    var result = confirm("Are you sure?");  

    if (!result) {
        revertFunc();
    }   
};

hope it helps

George
  • 716
  • 1
  • 12
  • 29
  • I used `confirm()` at first, but the user would have to move around with the cursor, which can lead to a waste of time when dealing with a lot of events. – Yuri May 18 '17 at 08:32
  • the Bootstrap Confirmation will popup on the old location of the event tho, – George May 19 '17 at 02:25
  • Every time, after a drop or a resize, the `eventRender()` is called and it will handle the resulting element on the DOM, so this makes me think that there is a way to show the popup on the final position. – Yuri May 19 '17 at 06:25