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

Changing Scheduler.CellGroupBy on runtime

Asked by Anonymous
7 years ago.

I'm trying to create a zooming navigation for scheduler as in this tutorial http://www.daypilot.org/demo/Scheduler/Zooming.aspx but even in the tutorial I can't zoom in more than one level. Looking at the code, I should be able to zoom in from year to month to week to day levels and back.

It seems that when CellGroupBy property is changed it is only partially noticed by the component. For example, when the property is first set to Month in PageLoad, it correctly displays Months in the topmost header. But, when I click the header to zoom in, the property is changed to Week in adjustCellLayout() (called by DayPilotScheduler1_Command()) and in the debugger I can see that it is changed correctly, but in BeforeTimeHeaderRender handler e.InnerHTML is still a month name instead of a week number even though the CellGroupBy property is Week.

I tried changing the DPS.Update() call in DPS_Command handler to UpdateType.Full but it had no effect.

Comment posted by Anonymous
7 years ago.

A picture to explain the problem: http://imgur.com/S9ALILs

Answer posted by Anonymous
7 years ago.

Fixed it by adding
"if (level == 0) groupBy = _scheduler.CellGroupBy;"
to function "private TimeHeaderRow PrepareGroupline(int level)" in SchedulerTimeHeader.cs after line "GroupBy groupBy = _scheduler.TimeHeadersResolved[level].GroupBy;"

Comment posted by Barrie
7 years ago.

Can confirm this works in DayPilotPro 7.7.3045. I was also having the problem where switching CellGroubBy dynamically at runtime was causing problems. We were defaulting at Week view and when moving to Day view it should have been showing hourly AM PM segments in the top header but was still just showing the day of the week. I added this just below the first 3 statements in the method so it now reads like this:

private TimeHeaderRow PrepareGroupline(int level)
{
TimeHeaderRow _groupline = new TimeHeaderRow();
GroupBy groupBy = _scheduler.TimeHeadersResolved[level].GroupBy;
string format = _scheduler.TimeHeadersResolved[level].Format;

if (level == 0)
{
groupBy = _scheduler.CellGroupBy;
}

...

That has fixed the problem and we can change CellGroupBy at runtime and it works as expected.

Comment posted by Barrie
7 years ago.

Unfortunately, this doesn't quite fix everything. If you go from Week -> Day -> Week it will throw a JavaScript error of "$0i is not defined".

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