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

Change Navigator Week When Event Clicked in Month

Asked by David
10 years ago.

I want to be able to click on an event in DayPilotMonth and have the navigator default date change to the date of that event instead of the current day so that when the user then selects the Week or Day, it displays that week or day instead of the last one clicked in Navigator. In other words, I want to change the Navigator date to the date of an event when that event is clicked in DayPilotMonth.

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

You can change the navigator date using .select(date) method:

http://api.daypilot.org/daypilot-navigator-select/

You can call it from the EventClickJavaScript handler:

@Html.DayPilotMonth("dpm", new DayPilotMonthConfig {
  BackendUrl = ResolveUrl("~/Month/Backend"),
  EventClickHandling = EventClickHandlingType.JavaScript,
  EventClickJavaScript = "dpn.select(e.start());",
  ...
})

See also:
http://doc.daypilot.org/month/event-click/

Comment posted by David
10 years ago.

The date appearing in dp_week doesn't change and the date selected in navigator doesn't change. I put in the alert to confirm that it is getting the right date and it executes the switcher command, so the code isn't failing. Here is my code snippet:
@Html.DayPilotMonth("dp_month", new DayPilotMonthConfig
{
BackendUrl = Url.Content("~/Backend/Month"),
CssOnly = true,
CssClassPrefix = "month_white",
EventHeight = 25,
EventClickHandling = DayPilot.Web.Mvc.Events.Month.EventClickHandlingType.JavaScript,
EventClickJavaScript = "ChangePage(e.start())",
EventDoubleClickHandling = DayPilot.Web.Mvc.Events.Month.EventDoubleClickHandlingType.JavaScript,
EventDoubleClickJavaScript = "TripEdit(e.id())",
})
</div>
</div>

<script type="text/javascript">
function ChangePage(start) {
alert(start);
dp_navigator.select(start);
switcher.select(dp_week);
}

Comment posted by Dan Letecky [DayPilot]
10 years ago.

Please let me check that.

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