Today I had the need to modify the output of the title field in a SharePoint list view. It’s a perfect task for JSLink. So, created the script, added the file to my SharePoint site and configured the view to use this JSLink file. A straight forward process.

But I was wondering, why my output was not modified. I always saw the value, as it would come without a JSLink modification. Did some debugging and my function was never called.

Thought a little about the title field, and stop. In views, we have three different options to display the title and in view definitions we use separate field names (fieldref).

  • Title (Title only, no link)
  • LinkTitle (Title with link and with “…” suffix to open a dropdownmenu)
  • LinkTitleNoMenu (Title with link to the document or file but no “…” suffix)

Because in my view I used the LinkTitle, but mapped my function in the JSLink to the Title field, it was clear that my function could not be called. Modified the JSLink file to use LinkTitle and everything worked as expected.

For the “lessons learned”: when creating a JSLink script for the Title field, consider all three field names.

Advertisements