Selecting event automatically in the current view

2 posts, 1 answers
  1. Bat-Erdene
    Bat-Erdene avatar
    4 posts
    Member since:
    May 2015

    Posted 15 Jun 2015 Link to this post

    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.






  2. Answer
    Alexander Popov
    Alexander Popov avatar
    1444 posts

    Posted 17 Jun 2015 Link to this post


    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[0]); //select the first event

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top