0

I know this is probably an easy thing, but I'm not finding it anywhere (my GoogleFu isn't up to par, I guess). I'm trying to remove column headers in a list when reformatting using JSLink. We are currently using SP2013.

Basically, I have a list with two columns. One column stores a URL, while the other column stores the description (or what is displayed as the hyperlink). When all is said and done, I only want the hyperlink to be displayed. At this point, I'm able to display what I want using the following code, but I don't know how to turn off the headings:

(function () {

var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {

'URL': { 'View': quickLinks },
'Title': { 'View': quickLinks2 }

};

SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);

}) ();

function quickLinks(ctx) {

    var urllink = ctx.CurrentItem.URL;
    var urldesc = ctx.CurrentItem.Title;
    var appeldLink = "<a href=" + urllink + ">" + urldesc + "</a>";

    return appendLink;

}

function quickLinks2(ctx) {

    var urldesc2 = "";

    return urldesc2;

}

I'm sure what I'm asking to do is uber easy ... I'm just not finding it. What can I add to the above code to remove the column headers? (NOTE: The above code is working just fine to display what I need. I'm just looking to be rid of the column headers.)

1 Answer 1

1

There's a Header Template you can use to override the header:

overrideCtx.Templates.Header = function(ctx) {return "--"};

This plugin may help you: https://chrome.google.com/webstore/detail/cisar/nifbdojdggkboiifaklkamfpjcmgafpo?hl=en

2
  • Thanks Omar. I will try this tomorrow when I get back to work. Oct 18, 2021 at 21:45
  • This worked, however, it removed my formatting below the headers, stacking all of my hyperlinks in a single line. Also, the return of two dashes ["--"] didn't fit either. To overcome these two things, I added a <br> in the quickLinks function and removed the dashes. This gave me what I needed. Oct 19, 2021 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.