search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Event double click

Asked by Naomi
5 years ago.

I'd like to show the Edit Modal form (quite complex form with lots of details) when I either double click on my event or using the right click menu item.

I see several options for this property

https://api.daypilot.org/daypilot-scheduler-eventdoubleclickhandling/

Should I use "Edit"? In my right click context menu I added (no code yet):

items: [
                    {
                        text: Resource.getLabel("bookingDetails"),
                        onclick() { self.getBookingDetails(this.source); }
                    },

So, how can I use the same procedure for both right click and double click and which option should I chose?

Thanks in advance.

Answer posted by Dan Letecky [DayPilot]
5 years ago.

For the double click you should use:

eventDoubleClickHandling: "Enabled",
onEventDoubleClick: function(args) {
  // open modal here, event details are in args.e
}

The context menu item should look like this:

contextMenu: new DayPilot.Menu({
  items: [
    { 
      text: "Edit",
      onClick: function(args) {
        // open modal here, event details are in args.source
      }
    }
  ]
});

The modal dialog needs to be a standalone page that accepts the event id in its URL, lets say "/edit?id=123".

You can open the modal like this:

var modal = new DayPilot.Modal({
  onClose: function(args) {
    // work with args.result here
  }
});
modal.showUrl("/edit?id=" + args.e.id());

Inside this page, you need to add "Save" button that closes the modal and sends data back to onClose. Inline onclick attribute is used for brevity:

<button onclick="DayPilot.Modal.close('saved');">Save</button>

And a "Cancel" button would look like this:

<button onclick="DayPilot.Modal.close()">Cancel</button>

More on the modal here:
https://code.daypilot.org/81367/daypilot-modal

Comment posted by Naomi
5 years ago.

Thanks, going to look into it. BTW, there is no 'Enabled' option in your doc. I was going to tell you that :)

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.