Unplanned
Last Updated: 27 Feb 2025 09:29 by ADMIN
Mike
Created on: 20 Feb 2025 16:24
Category: Scheduler
Type: Bug Report
0
Other Month CSS classes not being rendered for days outside of the current month

In the scheduler for Asp.net Ajax, the month view would put a k-other-month class on the cells from other months outside of the current one and those cells would have a different style (grayed day numbers or background, etc.).  In the Blazor scheduler component it doesn't look like that class is being put on those cells anymore. The Telerik SCSS themes still allow for that class, so is there a way to add them or is there a workaround so that those cells can be re-styled similar to the way the Ajax Scheduler functions?

Thanks,

Mike

1 comment
ADMIN
Dimo
Posted on: 27 Feb 2025 09:29

Hello Mike,

Thanks for reporting this. And yes, here is a workaround:

<TelerikScheduler Data="@SchedulerData"
                  @bind-Date="@SchedulerDate"
                  @bind-View="@SchedulerView"
                  OnCellRender="@OnSchedulerCellRender">
    <SchedulerViews>
        <SchedulerMonthView />
    </SchedulerViews>
</TelerikScheduler>

@code {
    private DateTime SchedulerDate { get; set; } = DateTime.Today;
    private DateTime StartTime { get; set; } = DateTime.Today.AddHours(7);

    private SchedulerView SchedulerView { get; set; } = SchedulerView.Month;

    private List<Appointment> SchedulerData { get; set; } = new();

    private void OnSchedulerCellRender(SchedulerCellRenderEventArgs args)
    {
        if (SchedulerView == SchedulerView.Month && args.Start.Month != SchedulerDate.Month)
        {
            args.Class = "k-other-month";
        }
    }

    public class Appointment
    {
        public Guid Id { get; set; }
        public string Title { get; set; } = string.Empty;
        public DateTime Start { get; set; }
        public DateTime End { get; set; }
        public bool IsAllDay { get; set; }
        public string Description { get; set; } = string.Empty;

        public Appointment()
        {
            var rand = new Random();
            Id = Guid.NewGuid();
        }
    }
}

 

Regards,
Dimo
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!