Online365: CSR does not work for Calendar Forms?
-
28-12-2020 - |
سؤال
subj
no workarounds?
"use strict";
var defaultSubtypeLookupFieldTemplate = SPClientTemplates._defaultTemplates.Fields.default.all.all.Lookup.NewForm;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
// ..
});
On calendar NewForm.aspx get:
Uncaught ReferenceError: SPClientTemplates is not defined
Tried to wrap with this code, looks like it does not apply(no results, no errors):
ExecuteOrDelayUntilScriptLoaded(function () {
var defaultSubtypeLookupFieldTemplate = SPClientTemplates._defaultTemplates.Fields.default.all.all.Lookup.NewForm;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
// ..
});
}, 'ClientTemplates.js');
المحلول
The JSLink property is not supported on Survey or Events lists. A SharePoint calendar is an Events list.
So there is no OOTB way to attach CSR js code with calendar list. For a workaround, you can create your own jQuery or vanilla javascript code and add it on the page by adding the reference in Content Editor Webpart/Script Editor webpart on that page.
Reference - Customize a list view in SharePoint Add-ins using client-side rendering
You can also checkout SPUtility.js or SPServices. They are quite decent and well documented.
لا تنتمي إلى sharepoint.stackexchange