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

Howto modify resources/datasource on scheduler during javascript refresh

Asked by Eric
15 years ago.

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?

Comment posted by Dan Letecky
15 years ago.

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 Eric
15 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 Dan Letecky
15 years ago.

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

Comment posted by Eric
15 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 Dan Letecky
15 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
15 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;

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