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

Scheduler never returns from Callback when after third event is selected.

Asked by Chris
8 years ago.

Hi,

first of all, I have to say, that I'm not entirely sure this is a bug. Hopefully you guys can reproduce it.

When an event is selected, I'd like to render the events again so I can set a special background to selected
events.
So I have this in the Scheduler's declaration:

EventSelectHandling="CallBack" OnEventSelect="Scheduler_OnEventSelect" AllowMultiSelect="True"

And in code behind I got this handler:

Protected Sub Scheduler_OnEventSelect(sender As Object, e As DayPilotEventArgs)
SetDataSourceAndBind()
Scheduler.Update()
End Sub

When I select 3 events via CTRL after the third selection, the scheduler never returns from it's callback, meaning the loading label is visible and the scheduler is blocked because BlockOnCallBack="True".

Any ideas why this is happening?

Kind regards
Chris

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

This usually means there is a JavaScript error that prevents the callback from completing.

1. You should be able to the details of the error it in the JavaScript console.

2. Sometimes, the client-side error is caused by a server-side error that results in an incorrect response (HTML with the error message instead of JSON message). You should be able to check that by checking the last response in the Network tab of Chrome developer tools.

If you post the error details here I can help with finding the cause (it might be a DayPilot bug or a bug in your code).

Comment posted by Chris
8 years ago.

Hi,

IE console showed no error, but FFs did. There is indeed a javascript error:
"SyntaxError: JSON.Parse: unexpected character at line 1 column 1 of the JSON data"

In the network tab the last response says (after a long non-readable string)
"System.InvalidCastException: Das Objekt des Typs "System.Object" kann nicht in Typ "System.String" umgewandelt werden.
bei DayPilot.Web.Ui.Events.TagCollection.ToJson()
bei DayPilot.Web.Ui.Events.Common.EventInfo.ToJson()
bei DayPilot.Web.Ui.DayPilotScheduler.GetSelectedEvents()
bei DayPilot.Web.Ui.DayPilotScheduler.System.Web.UI.ICallbackEventHandler.GetCallbackResult()"

Above error is in german and roughly says "Object of type 'System.Object' can not be converted to type 'System.String'"

I don't know how I can look into that JSON data that is causing the error.

Thanks for the quick reply!

Kind regards
Chris

Comment posted by Chris
8 years ago.

Aside from that: Can't I change the events background without a callback just on the client?
As of now all events are colored inside BeforeEventRender, but it that seems not really necessary if the
user just selects an event to make a callback.

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

> "System.InvalidCastException: Das Objekt des Typs "System.Object" kann nicht in Typ "System.String" umgewandelt werden.

This looks like a serialization problem. It happens when one of the tag values is null.

It should be fixed now in the latest sandbox build (8.1.3483):

http://www.daypilot.org/sandbox/

> Can't I change the events background without a callback just on the client?

Yes, you can. You need the DayPilot.Event object (which is usually accessible in the JavaScript event handler; you can also get it using dp.events.find() on the client side)

  e.data.backColor = "red";   // e -> DayPilot.Event object
  dp.events.update(e);      // dp -> DayPilot.Scheduler object (set using ClientObjectName attribute in ASP.NET)
Comment posted by Chris
8 years ago.

Thanks a lot for the support!

I will test the sandbox build later and let you know if the problem is gone.

Comment posted by Chris
8 years ago.

I guess selecting an event (so it's server-side in the Scheduler.SelectedEvents list) at the client scheduler object is not possible?

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

You can select it on the client side using .multiselect.add():

http://api.daypilot.org/daypilot-scheduler-multiselect-add/

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