Contents
Open the Default.aspx page and add the following code as the last child of the asp:Content element that has ContentPlaceHolderID set to PlaceHolderMain. Use the F5 key to deploy and run your add-in. Visual Studio makes a temporary installation of the add-in on your test SharePoint site and immediately runs the add-in.
To do this, we are going to write JavaScript code that will automatically be run on the page load when the WebPart is rendering. Before SharePoint renders the view of the list on the page, we will step in and instead give SharePoint something else to render. As a developer, maybe some of the wordage just used is already getting your wheels turning.
How to create a custom action in SharePoint?
Right-click the SharePoint Add-in project, and select Add > New Item > Office/SharePoint > Menu Item Custom Action. Keep the default name, and then select Add. The Create Custom Action for Menu Item Wizard asks you a series of questions.
Is there support for client side rendering in SharePoint?
JSLink based customizations (client-side rendering) are not supported in modern experiences. This includes modern lists and libraries, including JSLink support in the list view web parts of the modern pages. Client-side rendering is supported in the classic experiences in SharePoint Online or in on-premises.
How does client side rendering affect list view?
The client-side rendering that you have configured affects the rendering of the field only on the list view page, not in the list view web part that we put on the home page. This is because the web part defaults to server-side rendering. There are ways to reverse this, but they are too advanced for this simple example.
How to add custom rendering to JavaScript file?
In Solution Explorer, right-click the Scripts node, and then select Add > New Item > Web. Select JavaScript File and name it OrientationStageRendering.js. Your custom rendering of the field should happen automatically, so use the following code to add an anonymous method to the JavaScript that runs automatically when the file loads: