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

Scheduler Event Resizing, notifying user of the overlap and then undoing the resize?

Asked by mrplatypus
7 years ago.

Hi Dan and Team,

Is it possible to:

1) allow scheduler event resizing, AND
2) being able to notify the user of the overlap so that the user "sees" that they are unable to resize an event
3) then have the scheduler automatically undo the issue?

Please help.

Alternatively please would you suggest how to achieve the functionality as described?

Thanks & Regards

Dave

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

In the ASP.NET version you can do it like this:

1. Set EventResizeHandling to "CallBack".
2. In the OnEventResize handler, perform your checks. If there is an overlap, use UpdateType.None and notify the user using UpdateWithMessage(). Do not update the database. Do not reload events.

protected void DayPilotScheduler1_EventResize(object sender, DayPilot.Web.Ui.Events.EventResizeEventArgs e)
{
  bool allowed = .... ; // perform the check
  if (allowed) {
    DbResizeEvent(e.Id, e.NewStart, e.NewEnd);  // update the db
    DayPilotScheduler1.DataSource = LoadEvents();  // reload events
    DayPilotScheduler1.UpdateWithMessage("Event resized");
  }
  else { 
    DayPilotScheduler1.UpdateWithMessage("Action denied, there is an overlap.");
    DayPilotScheduler1.Update(CallBackUpdateType.None);
  }
}
Comment posted by mrplatypus
7 years ago.

I've tried something similar:

I try to update the entry within the database rather than performing many checks to the database...

A return type indicates the problem and I can display an error message accordingly..

As the scheduler component seems to be working off of javascript or similar, the UI/scheduler control updates even though the database hasn't permitted the change...

Is there a way of getting the UI and the database back in sync?

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

Dave,

The default behavior for EventResizeHandling="CallBack" is not to update the event. If you don't call Update() in the event handler or use CallBackUpdateType.None the events will stay as they were before the UI action.

This is different for EventResizeHandling="Notify" where the Scheduler updates the UI immediately and then it calls the server-side event handler.

In both cases, you can reset the events by reloading the DataSource and calling Update().

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

Answer posted by mrplatypus
7 years ago.

Dan,

Thanks for your answer and advice.
All working for me now.

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