I'm having issues adding a hyperlink to a field using the below. My column field is called LinkTitle (single Line of Text) My view is called Dashboard and i have refrenced the js like so ~sitecollection/SiteName/SiteAssets/jsLink.js But it doesn't work. Any ideas what i'm doing wrong or missing?
(function () {
// Create an object that have the context information about the fields that we want to change the rendering of.
var nameFiledContext = {};
nameFiledContext.Templates = {};
nameFiledContext.Templates.Fields = {
// Apply the new hyperlink HTML Rendering to the field in your view. Swap out "<Your Field Name>" for your field name
"LinkTitle": { "View": DashBoard }
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(nameFiledContext);
})();
// This function applies the rendering logic
function DashBoard(ctx) {
var name = ctx.CurrentItem.LinkTitle; //Swap out name variable for whatever field contains your hyperlink name
return "<a target='_blank' href='http://google.com"
+ name + "</a>"; //Put the url for your hyperlink in the href above
}