Home Unanswered Active Tags New Question

Howto modify resources/datasource on scheduler during javascript refresh

I noticed that when I modify the resources/datasource when refreshing a scheduler the data displayed is inconsistent with the data bounded to the scheduler. Is it even possible?

Asked by Eric 3 years ago.
Replies

You should make sure that you execute a full update in a CallBack handler when changing the resources:

DayPilotScheduler1.Update(CallBackUpdateType.Full);

The default update mode is to refresh only events:

DayPilotScheduler1.Update();
Comment posted by Dan Letecky 3 years ago.

I use a full update, but still have the problem, in short, I'm doing the following.

(On callback refresh)

scheduler.Resources.Clear();

foreach(Resource resource in myResources)

scheduler.Resources.Add(resource)

scheduler.DataSource = mySchedules;

scheduler.DataBind();

scheduler.Update(CallBackUpdate.Full);

--------------

When the page is loaded for the first time this works correctly. On refresh, when the amount of resources/schedules are changed the resources aren't updated.

Comment posted by Eric 3 years ago.

You are right, it doesn't work. There is a bug somewhere, let me check it.

Comment posted by Dan Letecky 3 years ago.

i guess i found the bug, you forgot to call the 'drawResHeader();' function in the 'DayPilotScheduler.updateView' method. I've added 'calendar.drawResHeader();' on line 222 in the 'Scheduler.src.js'.

Comment posted by Eric 3 years ago.

It's now fixed in the code. The fix will be included in the next release. If you want to test it now, please contact me at support@daypilot.org.

Thanks for reporting the bug!

Comment posted by Dan Letecky 3 years ago.

> you forgot to call the 'drawResHeader();' function in the 'DayPilotScheduler.updateView' method. I've added 'calendar.drawResHeader();' on line 222 in the 'Scheduler.src.js'.

I've placed it inside theif (result.UpdateType == "Full") {} block so it's not unnecessarily redrawn during regular updates. This line has to be moved above that block:

calendar.rows = result.Rows;

Comment posted by Dan Letecky 3 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java