How to retrieve scheduler current date range in C#?

8 posts, 0 answers
  1. Ther Pick
    Ther Pick avatar
    5 posts
    Member since:
    Nov 2017

    Posted 29 Jan 2018 Link to this post

    Hi,

    May I know how to retrieve Kendo Scheduler current date range in C# code?

    I need to date range so I can populate the date in another detail table.

    Thank you.

  2. Neli
    Admin
    Neli avatar
    339 posts

    Posted 30 Jan 2018 Link to this post

    Hi,

    The following article demonstrates how to retrieve the current date range.

    An example on how to subscribe to the Scheduler events in MVC project is described in the following demo.

    I hope that the provided information will be helpful. 

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Ther Pick
    Ther Pick avatar
    5 posts
    Member since:
    Nov 2017

    Posted 31 Jan 2018 in reply to Neli Link to this post

    Hi Neli,

    Thank you for your reply. It is helpful but I have other similar questions here.

    How about I want to get all the date & time (calendar events) for the recurring schedule? 

    Besides that, is it any other ways to get all the date & time directly from C# without subscribing to the Scheduler javascript event? For eg: a helper method to generate the date & time using the record in DB? I need to use all the date & time information to generate data in another detail table in C#.

     

    Thank you.

  4. Neli
    Admin
    Neli avatar
    339 posts

    Posted 02 Feb 2018 Link to this post

    Hello,

    If I understand correctly, you need to retrieve the date and time of all the recurring events.

    In case you need to retrieve the data about all initial recurring events, you can use DataSource data() method
    var scheduler = $('#scheduler').data('kendoScheduler');
    var data = scheduler.dataSource.data();

    Next you can filter all the events, by checking their recurrence rule:
    var recurring = data.filter(e => e.recurrenceRule != null && e.recurrenceRule != "");

    Then, you can access the start and end time of all the events
    recurring.forEach(function(e){           
    console.log('START: ' + e.start + ' END: ' + e.end);
    })

    In the linked Dojo example the start and end time of all recurring events will be console logged on button click. The approach in MVC project will be the same. 


    In case you need to retrieve the data about all occurrences of the events, you can use the occurrencesInRange method. This method returns a list of the event occurrences for specified range. You will need to filter the events, by checking if they have recurrenceRule or recurrenceId. Note, that the result of this method is scoped to the currently displayed view.
    var events = scheduler.occurrencesInRange(new Date("2013/6/5"), new Date("2013/6/10")); 
    var ocurrencies = events.filter(e => e.recurrenceRule != null &&
                                             e.recurrenceRule != undefined ||
                                             e.recurrenceId);

    In the Dojo example linked here, the recurring event occurrences are console logged. 

    I am afraid, that the data about the recurring events could not be retrieved directly from the C# code. In order to get the data regarding the recurring event occurrencies you will need to do it client-side, as it is described above.

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Ther Pick
    Ther Pick avatar
    5 posts
    Member since:
    Nov 2017

    Posted 12 Feb 2018 in reply to Neli Link to this post

    Hi Neli,

    The occurrencesInRange method is helpful. But as what you wrote, it is scoped to currently displayed view only. 

    Any other methods that will return beyond the scope? For e.g. 1 year date range?

    Thank you very much.

     

  6. Neli
    Admin
    Neli avatar
    339 posts

    Posted 13 Feb 2018 Link to this post

    Hello Ther Pick,

    I am afraid that Scheduler API does not provide methods to check all occurrences of recurring event, that are not part of the currently displayed view.
    I would suggest you to log the idea as a feature request in our Feedback portal. Based on the support it receives from the community, we will decide on whether to proceed with its implementation or not. 

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Sean
    Sean avatar
    1 posts
    Member since:
    Jun 2020

    Posted 02 Oct in reply to Neli Link to this post

    Hi Neli,

    Is this still un-solved or anything we can do to generate the recurrence dates beyond the front-view? Please suggest. Thanks

    Regards,

  8. Neli
    Admin
    Neli avatar
    339 posts

    Posted 06 Oct Link to this post

    Hi Sean,

    The occurrences of the recurring events in the Scheduler could be retrieved through the occurrenceInRange method. As it is written in my previous replies the result is scoped to the currently displayed view. So, the specified range should be within the view's time range. I am afraid that I could not suggest a workaround in order to retrieve all the occurrences that are not part of the currently displayed view. 

    If you think, that such functionality would add value to the widget, I would suggest you log your idea as a feature request on our Feedback portal. This way the other users could vote for the idea. if the community shows interest in having such a feature, we will consider enhancing the component.

    Regards,
    Neli
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top