Scheduler focus on timeline

Hi,

Is it possible to focus the scheduler to current time on loading rather than start time of scheduler.



Thanks Regards,
Smisha Alias

5 Replies 1 reply marked as answer

PN Praveenkumar Narasimhanaidu Syncfusion Team May 21, 2021 12:32 PM UTC

Hi Smisha, 

Greetings from Syncfusion support..! 

Yes, it is possible to focus the scheduler to current time on loading. You can achieve this requirement by using the scheduler’s DataBound event and below highlighted code snippet. We have also prepared a sample for your reference which can be downloaded from the following link. 


    public async Task OnDataBound(DataBoundEventArgs<AppointmentData> args) 
    { 
        if (Flag == true) 
        { 
            Flag = false; 
            var CurrentTime = DateTime.Now; 
            var Hours = CurrentTime.Hour - 4 < 10 ? '0' + (CurrentTime.Hour - 4).ToString() : (CurrentTime.Hour - 4).ToString(); 
            var Minutes = CurrentTime.Minute.ToString(); 
            var Time = Hours + ":" + Minutes; 
            await ScheduleRef.ScrollTo(Time, CurrentTime); 
        } 
 
    } 

Kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Praveenkumar 


Marked as answer

CL Carlos Lopez April 19, 2022 04:50 PM UTC

Does await ScheduleRef.ScrollTo(Time, CurrentTime); work on the default calendar view (not the timeline view) ?



RM Ruksar Moosa Sait Syncfusion Team April 20, 2022 01:44 PM UTC

Hi Carlos,


Yes. The ScrollToAsync method also works in the default calendar views.

Kindly check the attached sample and let us know if you any assistance.


Regards,

Ruksar Moosa Sait


Attachment: ScrollTo_5053c6cd.zip


CL Carlos Lopez replied to Ruksar Moosa Sait April 20, 2022 09:35 PM UTC

Thank you for your example! After comparing examples I found that my issue was not specifying a height for my SfSchedule tag.



VM Vengatesh Maniraj Syncfusion Team April 21, 2022 08:48 AM UTC

Hi Carlos,


Thanks for the update.

Please let us know if you need any further assistance on SfSchedule.


Regards,

Vengatesh 


Loader.
Up arrow icon