5

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).

  • 1
    Sorry to asking in old thread. According to this msdn article, "The JSLink property is not supported on Survey or Events lists. A SharePoint calendar is an Events list." So did you find any workaround? – Mark L Jan 18 '17 at 2:35
  • @MarkL no problem with asking in a old post :) unfortunately I can't remember in which project this requirement is applied "and so, I cannot remember how I solve this in another way" :( – Mauricio Arias Olave Jan 18 '17 at 16:03
-1

There is no file clienttemplates.js on calendar view page, so Calendar List View in SharePoint 2013 not support CSR. Check the below article. It might help you to solve your problem:

Calendar list view SharePoint 2013 customization

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.