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

[?] How to change the Event Areas value from dps.contextMenu

Asked by Thomas Lee
12 days ago.

I have a Daypilot Scheduler, I use event "onBeforeEventRender" to render the Event Areas like this
args.e.areas = [{ html: jsonTags.AreasHTML, right: jsonTags.AreasRight, bottom: jsonTags.AreasBottom }];
and I also have dp.contextMenu with 2 options "Confirm" and "Unconfirm"
What I would like to ask your help is, how we can change args.e.areas when I hit option "Confirm"?
My scenario is, after hit option "Confirm" , the expected Event Areas will be
args.e.areas = [{ html: "Confirmed", right: jsonTags.AreasRight, bottom: jsonTags.AreasBottom }];

Thank in advance,
Thomas Lee

Answer posted by Dan Letecky [DayPilot]
12 days ago.

If you have access to the DayPilot.Event object (e) you can change it like this:

// e holds DayPilot.Event object
e.data.areas = [{ html: "Confirmed", right: jsonTags.AreasRight, bottom: jsonTags.AreasBottom }];
dp.events.update(e);

In the context menu item, you can access the source DayPilot.Event object as args.source in onClick:

// ...
onClick: function(args) {
  var e = args.source;
  e.data.areas = [{ html: "Confirmed", right: jsonTags.AreasRight, bottom: jsonTags.AreasBottom }];
  dp.events.update(e);
}

DayPilot.Scheduler.events.update() will redraw the event:
https://api.daypilot.org/daypilot-scheduler-events-update/

Let me know if it doesn't work as expected.

New Reply
This reply is
Your name (optional):