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

Is there a way to await an event (commandCallBack)?

Asked by DG
10 years ago.

Hi Dan,

I am using the dps.commandCallBack for doing various things (refreshing the control for various conditions) asynchronously.

I call dps.commandCallBack, and I do some minor client side manipulation on the control. But I want to do that manipulation only after the server side call has ended, AND the scheduler has been refreshed for that (because otherwise, my changes get overridden by the daypilot handler refresh).

Is there any way I can wait for that, or check if the handler has done its job?

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

You can use AfterRender client-side handler (AfterRenderJavaScript property in MVC DayPilotSchedulerConfig).

This script will get called after every update (including the initial rendering). You can also pass custom data to it using Update(data) call.

Example:

<%= Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig {
  BackendUrl = ResolveUrl("~/Scheduler/Backend"),
  AfterRenderJavaScript="afterRender(data, isCallBack);"
  ...
%>

<script type="text/javascript">
function afterRender(data, isCallBack) {
  if (isCallBack) {
    alert('Rendering finished (after callback)');
  }
  else {
    alert('Initialization finished');
  }
}
</script>
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.