SharePoint 2013 Customize View
2July 23, 2013 by Ravi C Khambhati
Here is the new post after a long time.
While I was working on the SharePoint 2013 I came to know very interesting Client Side Rending approach.
Follow below steps to customize the view,
1. Identify the view and edit JSLink property of view with the custom js file. For e.g. customclienttemplates.js. You can do this either with schema file or SharePoint Manager 2013
2. Edit customclienttemplates.js with below content. This script will edit title column to hyperlink and will redirect to view page.
(function () { var overrideCtx = {}; overrideCtx.Templates = {}; overrideCtx.Templates.Fields = { 'Title': { 'View': TitleBody } }; SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);} )(); function TitleBody(ctx) { var ret = "<a href='" + ctx.displayFormUrl + "&ID=" + ctx.CurrentItem.ID + "'>" + ctx.CurrentItem.Title + "</a>"; return ret; }
3. Do IISreset
4. Navigate to list view
Apart from this solution I would like to give you some tips,
If you would like to do more customization you can debug JavaScript with Visual Studio and you can see more properties.
Below is the image of ctx watch
Same way you can watch of ctx.CurrentItem and see all properties.
I would like to thank to “Jussi Palo” to understand the concept.
http://blog.jussipalo.com/2013/05/sharepoint-2013-linking-item-titles-to.html
Very nice article, with good details. Happy sharepointing 🙂
Regards,
Manish Patil
Thanks Manish