5

Yes, I know this is a duplicate, but the other answers are now out of date. I am using SharePoint online with SharePoint Designer 2013.

I want to set disable-output-escaping=yes for a SharePoint list view.

Here is what i have tried:

  • I set the field type to number. This works on older versions of SharePoint, but no longer works on SharePoint online.
  • I tried opening it design view in SharePoint designer, but that no longer exists in SharePoint Designer 2013
  • I tried setting up a custom XSL but it just causes an error. Where do I add the XSL to get it to work correctly? The itself references the main.xsl. If I knew where that file was, I could copy it as a starting point to create my own XSL, but I can't find it in the site anywhere.

Here is the relevant piece of my view aspx:

<FieldRef Name="After_x0020_Mitigation"/></ViewFields>
<RowLimit Paged="TRUE">100</RowLimit><Aggregations Value="Off"/
<JSLink>clienttemplates.js</JSLink><XslLink default="TRUE">Main.xsl</XslLink>
Greg Viers
  • 3,473
  • 3
  • 18
  • 36

1 Answers1

0

I don't know where to put 'disable-output-escaping=yes' and I couldn't find the information.

But, you can use field templates to achieve this result. Something like this;

(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 
        "<Your Field Name>": { "View": nameFiledTemplate }  
    };  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(nameFiledContext);  
})();  
  
// This function applies the rendering logic 
function nameFiledTemplate(ctx) {  
    var name = ctx.CurrentItem.ID;  //Swap out name variable for whatever field contains your hyperlink name
            
    return "<a target='_blank' href='<Your Hyperlink Here>'>"   
        + name + "</a>";      //Put the url for your hyperlink in the href above
}  
bahadrdsr
  • 424
  • 3
  • 7