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

Scheduler not working

Asked by Cezar
7 years ago.

It's funny thing, because on Friday everything worked fine, today I start my app and scheduler is not loading properly.
This is my scheduler controller code: http://pastebin.com/3pKJQT1N
View: http://pastebin.com/7dj2D3f7
Controller which I use to go to view (of course on friday date was 20th January 2017, same hours): http://pastebin.com/HfB9hwCq
and screen how it looks now is in attachement.
Funny, but I didn't change anything except the date (last date is not working aswell) What can I do now?

On clean JS scheduler with example data it renders properly, code: http://pastebin.com/E3Q022iE

Comment posted by Cezar
7 years ago.

Here is fill rendered html of non-working scheduler.

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

I didn't inspect your code in detail but something like this can happen if the following conditions are met:

1. You use a configuration that displays just one day.
2. You use a configuration that hides non-business hours: https://doc.daypilot.org/scheduler/hiding-non-business-hours/
3. It's Saturday or Sunday

Comment posted by Cezar
7 years ago.

Right, my bad.
So how can I enable in MVC Saturdays and Sundays?

protected override void OnBeforeCellRender(BeforeCellRenderArgs e)
{
if ((e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday))
{
e.IsBusiness = true;
}
}

doesn't work.

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

You can use OnIncludeCell():

            protected override void OnIncludeCell(IncludeCellArgs e)
            {
                if (e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday)
                {
                    e.Visible = true;
                }
            }

Let me know if it didn't help.

Comment posted by Cezar
7 years ago.

It works fine, thank you a lot.

Comment posted by Cezar
7 years ago.

But how should I write the function to see only business hours on weekends aswell? For now NonBusiness hours are hidden on work day, but on weekend all hours are visible.

Answer posted by Cezar
7 years ago.

Ok, nevermind I just used the function I wrote before:

protected override void OnBeforeCellRender(BeforeCellRenderArgs e)
{
if ((e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday)
|| (e.Start.Hour >= 7 && e.Start.Hour < 23))
{
e.IsBusiness = true;
}
}

protected override void OnIncludeCell(IncludeCellArgs e)
{
if ((e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday) && (e.Start.Hour >= 7 && e.Start.Hour < 23))
{
e.Visible = true;
}
}

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

The Scheduler supports BusinessWeekends property (boolean) which does this for you (set BusinessWeekends = false in the config) but it's not available in the latest MVC release. However, it's now available in the latest sandbox build:

https://mvc.daypilot.org/sandbox/

It will be included in the next release.

Comment posted by Cezar
7 years ago.

Many thanks, it'll be much easier for everyone :)

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