This is a migrated thread and some comments may be shown as answers.

Selecting event automatically in the current view

1 Answer 51 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Bat-Erdene
Top achievements
Rank 1
Bat-Erdene asked on 15 Jun 2015, 11:11 AM

Hello there,

I am hoping you can help me with my little challange. I am trying to make scheduler select any event in the current view automatically after loading. Preferebly I would want it to select the event in the current date which would be today.

I have seen "Selecting Event programatically"  but it is not what i want. That one explains how to select an event assuming I know which event to select.

In my case I don't know the event so i just need the scheduler to select the event in the current view for me. it is also possible that there may not be any event on the current date. Also I haven't defined an id in my schema. I don't actually have an id which represent event rather I only have a string field. Is it possible to set the id to string field? I am specfying this just in case solution requires an id.

Thanks

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 17 Jun 2015, 08:37 AM
Hi,

You can do this by using the occurrencesInRange method to retrieve all events in the current view. For example: 
var view = scheduler.view(); //get the view
var events = scheduler.occurrencesInRange(view.startDate(), view.endDate()); //use the view's start and end dates to get the events
scheduler.select(events[0]); //select the first event

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Bat-Erdene
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or