I'm following the SharePoint 2013 Client Side Rendering: List Views article; but instead of apply CSR code to a ListView
, my objective is using CSR for apply it to a SPCalendarView
(Default view).
What I'm trying to accomplish is get the SPCalendarItems
inside of SPCalendarView
control and depending on a condition, add an anchor HTML element (i.e) <a href='#'>Link</a>
Example:
Let's say that we have a Calendar
List (with some recurrent and/or non-recurrent events).
The condition is:
If the day hasn't events on it add an html anchor element (with a link to New Form) For add a new event.
With the following code supplied by the link source:
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Footer: function(ctx) {
console.log(ctx);
return "Hello world from " + ctx.ListTitle + "!";
}
}});
I'm getting this error:
SPClientTemplates is not defined
Error may be caused because ListView
and SPCalendarView
are different; I tested on a ListView (as the article shows and there's no error).
I searched on internet but I'm unable to find CRS code used on a Calendar
view.
There's a way of accomplish this requirement?
I hope not change the scope of this question, but I'm open to get an C# solution for this (working on a Farm webpart).