Scheduler MVC Retrieve Current Date Range

2 posts, 0 answers
  1. ICT
    ICT avatar
    6 posts
    Member since:
    Oct 2017

    Posted 09 Jan 2018 Link to this post

    Hi 

    I've found a link which shows how to retrieve the current date range of a view using JQuery :

    https://docs.telerik.com/kendo-ui/controls/scheduling/scheduler/how-to/various/view-date-range

    I want to allow users to search resources via the currently selected date range.

    Is there a way to do this in MVC?

     

    Thank you

    Phil

     

     

     

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2064 posts

    Posted 11 Jan 2018 Link to this post

    Hi Phil,

    Both the Kendo UI Scheduler and its MVC wrapper use the same API so the approach for getting the current date range would be identical. The difference would be the event handlers attachment in the MVC Scheduler:
    .Events(e =>
    {
        e.DataBound("onDataBound");
        e.Navigate("onNavigate");
    })

    But the rest of the logic would be the same:
    <div class="console"></div>
     
    <script type="text/javascript">
        function onDataBound(e) {
            $(".console").append("<p><strong>Navigated to:</strong></p>");
            scheduler_view_range(e);
        }
     
        function onNavigate(e) {
            $(".console").append("<p><strong>Navigated from:</strong></p>");
        }
     
        function scheduler_view_range(e) {
            var view = e.sender.view();
     
            $(".console").append("<p>" + kendo.format("view:: start: {0:d}; end: {1:d};", view.startDate(), view.endDate()) + "</p>");
        }
    </script>

    Regards,
    Ivan Danchev
    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.
Back to Top