Async change dates on second Scheduler

If i put 2 schedulers on my page with the weekly view and I switch the dates of the second scheduler week view to be +7 days from current DateTime, it gives me a scheduler showing my current week and a scheduler showing nextweek. 

Is there a way to dynamically  and async change the dates of the second calendar view based on altering the date on the first calender using the date selection buttons?

3 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team January 19, 2021 08:57 AM UTC

Hi Nathanael, 

Greetings from Syncfusion Support. 

Yes we can change the current date of the second scheduler based on current date of first scheduler. We have prepared a sample for your reference which can be downloaded from the following link. 

<div class="col-lg-6 control-section"> 
    <SfSchedule TValue="AppointmentData" Height="650px" @bind-SelectedDate="@CurrentDate"> 
        <ScheduleEvents TValue="AppointmentData" Navigating="OnNavigating"></ScheduleEvents> 
        <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings> 
    </SfSchedule> 
    </div> 
<div class="col-lg-6 control-section"> 
    <SfSchedule TValue="AppointmentData" Height="650px" @bind-SelectedDate="@CurrentDate2"> 
        <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings> 
    </SfSchedule> 
</div> 
 
            DateTime CurrentDate = new DateTime(2020, 2, 14); 
            DateTime CurrentDate2 = new DateTime(2020, 2, 14).AddDays(7); 
            public void OnNavigating(NavigatingEventArgs args) 
            { 
                if (args.Action == "date") 
                { 
                    CurrentDate2 = args.CurrentDate.AddDays(7); 
                } 
            } 

In the above sample we have changed the selected date of second scheduler in the navigating event of first scheduler. Please try the sample and get back to us if you need any further assistance. 

Regards, 
Nevitha 


Marked as answer

NA Nathanael January 19, 2021 10:00 PM UTC

That worked perfectly! Thank you. 

I have another question, 

is it possible to hide the second scheduler until a click event? 

The user would be able to choose if they wanted to view 1 week or 2 weeks


NR Nevitha Ravi Syncfusion Team January 20, 2021 12:13 PM UTC

Hi Nathanael, 
 
You are most welcome..! 
 
Yes, we can render the second scheduler based on condition to meet your requirement. Please refer to the following sample. 
   @using Syncfusion.Blazor.Buttons 
<SfButton Content="Show/Hide" @onclick="OnButtonClick"></SfButton> 

        @
if (isShow) 
        { 
            <SfSchedule TValue="AppointmentData" Height="650px" @bind-SelectedDate="@CurrentDate2"> 
                <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings> 
            </SfSchedule> 
        }
    
bool isShow = false; 
    public void OnButtonClick() 
    { 
        isShow = !isShow; 
    } 
 
Please try the above solution and get back to us if you need any further assistance. 
 
Regards, 
Nevitha 


Loader.
Up arrow icon