I'm trying to write a javascript to open a URL in a new window. I'm not the best at javascript and can't seem to get the URL formatted correctly. Here is my example:
(function () { // Initialize the variables for overrides objects var overrideCtx = {}; overrideCtx.Templates = {}; // alert("Override call worked"); // Use BaseViewID and ListTemplateType to narrow focus/scope on // which web parts on the page are affected // overrideCtx.BaseViewID = 1; // overrideCtx.ListTemplateType = 100; /* * Using the Fields override leaves the rest of the rendering intact, but * allows control over one or more specific fields in the existing view */ overrideCtx.Templates.Fields = { //'LinkLocation': { 'View' : 'Animal' } //'LinkLocation': { 'View' : '<b><#=ctx.CurrentItem.LinkLocation#></b>'} //'LinkLocation': { 'View' : '<a href=ctx.CurrentItem.LinkLocation><#=ctx.CurrentItem.LinkLocation#></a>'} 'LinkLocation': { 'View' : '<div><a href=""ctx.CurrentItem.LinkLocation""><#=ctx.CurrentItem.LinkLocation#></a><div>'} }; /* * Register the template overrides. */ SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx); })();
I'm not sure how to put the quotations around the hyperlink. When I do get it sort of working it puts "ctx.CurrentItem.LinkLocation" in as the path along with the local hostname.
Can someone tell me what I'm doing wrong?
David Jenkins