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

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

5 Answers 170 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jake
Top achievements
Rank 1
Jake asked on 18 May 2017, 04:23 PM

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

5 Answers, 1 is accepted

Sort by
0
Sayer
Top achievements
Rank 1
answered on 18 May 2017, 09:27 PM

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

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

<p>#:numOfEvents#</p>

0
Dimitar
Telerik team
answered on 19 May 2017, 12:35 PM
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.
0
Jake
Top achievements
Rank 1
answered on 19 May 2017, 02:19 PM

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>
0
Jake
Top achievements
Rank 1
answered on 19 May 2017, 02:57 PM
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...
0
Ivan Danchev
Telerik team
answered on 23 May 2017, 11:56 AM
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.
Tags
Scheduler
Asked by
Jake
Top achievements
Rank 1
Answers by
Sayer
Top achievements
Rank 1
Dimitar
Telerik team
Jake
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or