0

I used client side rendering on a list view to override how the items inside it should be rendered.

The javascript:

var overrideContext = {};
overrideContext.BaseViewID = 3;
overrideContext.ListTemplateType = 951325;
overrideContext.Templates = {};
overrideContext.Templates.Header= renderHeader;
overrideContext.Templates.Item  = renderItem;
overrideContext.Templates.Footer = renderFooter;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);

The view:

<View BaseViewID="3" DisplayName="Overzicht" Type="HTML" SetupPath="Pages\ViewPage.aspx" Url="Overzicht.aspx">
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink Default="TRUE">~siteCollectionLayouts/RenderSummary.js</JSLink>
    <Toolbar Type="FreeForm" Position="After" />
    ....
</View>

The rendering works if the view is embedded in another page, but if you visit the list and select the view to which the jslink is applied errors occur:

Getting Error Message for Exception Microsoft.SharePoint.ApplicationRuntime.SafeControls+UnsafeControlException: Een webonderdeel of besturingselement voor een webformulier op deze pagina kan niet worden weergegeven of geïmporteerd. Het type is niet gevonden of staat niet als veilig geregistreerd.
[Translates as: a webpart or usercontrol for the form on this pages can not be found or imported. The type can not be found or is not registered as safe.]
at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Boolean isAppWeb, Guid guid, Guid solutionId, Nullable`1 solutionWebId, String assemblyFullName, String typeFullName, Boolean throwIfNotSafe)    
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

Application error when access /Lists/Nieuws/Overzicht.aspx, Error=Object reference not set to an instance of an object.  
at Microsoft.SharePoint.WebPartPages.WebPartResultSet.get_PartOrder()    
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)    

Does anyone have an idea what I could try to change to get the view page displaying as well?

2

Turns out the error was not caused by using the jslink but rather by a missing 'WebPartZoneID' attribute on the view definition. The following fixed it:

<View BaseViewID="3" DisplayName="Overzicht" WebPartZoneID="Main" Type="HTML" SetupPath="Pages\ViewPage.aspx" Url="Overzicht.aspx">

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.