Any way to access the number of events for a given day?

6 posts, 0 answers
  1. Jake
    Jake avatar
    5 posts
    Member since:
    Apr 2017

    Posted 18 May 2017 Link to this post

    I'm attempting to build a template for days in `month` view using view.dayTemplate. The reason I'm doing this is so that I can add a piece of text at the top right of each day showing the number of tasks in that day. Is there a method of accessing the number of events listed for a given day?

    Here is my desired template:

    <script id="monthview-day-template" type="text/x-kendo-template">
        <span><span data-bind="text: <event-count-here>"></span> Tasks</span>
    </script
  2. Sayer
    Sayer avatar
    16 posts
    Member since:
    May 2016

    Posted 18 May 2017 in reply to Jake Link to this post

    You can use occurrencesInRange in your template. Execute javascript in the template like:

    #var numOfEvents = scheduler.occurrencesInRange(startdate, endDate);#

    <p>#:numOfEvents#</p>

  3. Dimitar
    Admin
    Dimitar avatar
    473 posts

    Posted 19 May 2017 Link to this post

    Hi,

    I would suggest you to take a look at Create Custom Month Views with Event Count in the Show More Button example. It uses occurrencesInRange, as suggested.

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

    Posted 19 May 2017 in reply to Sayer Link to this post

    If I attempt to execute JS in my template, my function `scheduler.occurencesInRange(a, b) is not defined. It seems that any JS function I attempt to execute inside a kendo template using the template syntax `#= <js code here> #` results in a TypeError. The function is being declared in a JS file on the page instead of an inline <script> tag.

    <script id="monthview-day-template" type="text/x-kendo-template">
        <span>#= kendo.toString(date, 'dd') #</span>
        <span>#= scheduler.occurrencesInRange(someStartDate, someEndDate) # Tasksa</span>
    </script>
  5. Jake
    Jake avatar
    5 posts
    Member since:
    Apr 2017

    Posted 19 May 2017 in reply to Dimitar Link to this post

    Is there any documentation on the creating a custom MonthView other than that code snippet? There's a lot going on in that code you sent me and there's no explanation for what's going on at all...
  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2053 posts

    Posted 23 May 2017 Link to this post

    Hello Jake,

    Apart from the examples in the Custom Views sub-section within the Scheduler' How To documentation section, which the article Dimitar linked is part of, there isn't an article that provides extensive explanation on extending built-in views. The documentation is focused on explaining the built-in features and API of the widgets, rather than on the ways they can be extended by overriding their default behavior. Custom views can be different and would depend on the specific scenario and requirements, thus the articles in the HowTo section simply demonstrate particular scenarios, rather than being tutorials for creating custom views.

    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 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