1

I know how to customize the Listviews and/or the forms, using SPClientTemplates.TemplateManager.RegisterTemplateOverrides(context); Is there a way to customize the rendering of a calendar?

I've seen the core part is in the SP.UI.ApplicationPage.Calendar.js and the interesting function which allows me to customize entries could be SP.UI.ApplicationPages.CalendarItem.

How could I intercept it, since the js file is loaded dynamically after the masterpage has been rendered?

3
  • The JavaScript isn't going to be the override you're looking for. Instead, locate the proper CSS tag for the calendar field and then override that CSS tag with unique values on the list in question. Commented Mar 10, 2016 at 9:55
  • No, i want different colors for different entries....and it depends on a custom field of the calender object.
    – Emaborsa
    Commented Mar 10, 2016 at 10:13
  • You could try your own Immutable version of that calendar.js stuff and load it as a ScriptLink so it takes a stand way before other stuff loads, but applying changes after the DOM was created is probably a whole lot easier. Commented Mar 10, 2016 at 10:22

2 Answers 2

0

I think I see what you're trying to do. This should do the trick: https://www.degdigital.com/insights/four-easy-steps-to-customized-color-code-calendars-in-sharepoint/

2
  • I already have found this solution, but I cannot apply it. My calendar object has a custom field, which is a Lookup field to another list so this field may have 10/15 different value. Since this list is dynamic I would have to add or remove a calendar every time an item has been added and or deleted. The solution you posted would be OK if the custom field is a choice field.
    – Emaborsa
    Commented Mar 10, 2016 at 10:32
  • Given the dynamic nature of your filler, there would have to be some default colors for undefined types. You're most likely going to need to capture and override the JavaScript methods. Here's a nice article on that approach. codeproject.com/Tips/759006/… Commented Mar 11, 2016 at 10:00
0

At the end I had to do a very dirty work. I added a js to the JsLink and overrode some functions:

SP.UI.ApplicationPages.ItemBuilder.prototype.$4N_0 SP.UI.ApplicationPages.ItemBuilder.prototype.$8D_0 SP.UI.ApplicationPages.ItemBuilder.prototype.$5n_0 SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids SP.UI.ApplicationPages.DetailCalendarView.prototype.renderGrids

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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