(function () {
var overrideContext = {};
overrideContext.Templates = {};
overrideContext.Templates.Fields =
{
'Title': { 'View': overrideTemplate }
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();
function overrideTemplate(ctx) {
var title = ctx.CurrentItem.Title;
var name = ctx.CurrentItem["FileLeafRef"];
var myLink = "https://URL.../" + name;
return "<a id='myAnchor' href=" + encodeURI(myLink) + ">"
+ title + "</a>";
}
The purpose of this blog is to show techniques involving SharePoint development which is a platform I'm really passionate about. Some of techniques will include InfoPath, Nintex, Flow, REST API, CSOM/JSOM, PowerBI, etc...
Saturday, September 28, 2019
Using JSOM to make the Title column clickable on a SP list
I recently had a request to make the Title column of a SharePoint list clickable. You can simply use JSOM to override the template and render the Title column clickable. Don't forget to use "encodeURI" when returning the function in order to prevent issues with & ampersand in the URL.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment