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

TimeRangeSelectedHandling = TimeRangeSelectedHandlingType.CallBack Issue

Asked by B
8 years ago.

Hello there

I am using MVC scheduler and I'd like to call a popup window when I click an empty cell. I have found example using javascript which uses daypilot model extender, but I'd like to use the in-build bootstrap pop up window by calling a view

Have you got any example in MVC where I can call a view using
protected override void OnTimeRangeSelected(TimeRangeSelectedArgs e)
{
// I'd like to call a view or funcion which calls a view
}

Thanks
Binon

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

The CallBack is an internal mechanism that only allows communication with the server-side DayPilot backend. It exchanges messages in JSON format - in other words, you can't use it to open a modal dialog on the client side.

You should use TimeRangeSelectedHandling = TimeRangeSelectedHandlingType.JavaScript and a custom JavaScript code to open the modal dialog (TimeRangeSelectedJavaScript).

You can start with the example from the "Event Editing" documentation page:
https://doc.daypilot.org/scheduler/event-editing/

Just replace the "editEvent" JavaScript method with custom code that uses Boostrap popup instead.

@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig {
  BackendUrl = ResolveUrl("~/Scheduler/Backend"),
  ...
  EventClickHandling = EventClickHandlingType.JavaScript,
  EventClickJavaScript = "editEvent(e.id())"
})


<script type="text/javascript">
  function editEvent(id) {
    // your code here
  } 
</script>
Answer posted by B
8 years ago.

Thanks Dan

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