Showing posts with label jslink. Show all posts
Showing posts with label jslink. Show all posts

Friday, June 23, 2017

Rendering Related Items as links in SharePoint (classic lists)

I’m doing minor work on a SharePoint 2013 installation every now and then and got a request to render the Related Items column introduced in SharePoint 2013 as an actual link instead of showing the text 1 related items.

The customer is running a workflow for approval and the task list looks like this by default.

image

If you go to the view form of the item you get a link to the related items, but having this in the list view would be preferable.The end result after applying custom rendering of the field looks like the image below. Why Microsoft decided not to render out the link by default is a mystery, but could be developer design ;)

image

An answer at SharePoint Stack Exchange had the answer, but did not complete the puzzle 100%.
Note: DO NOT do as the link in that answer points to, which is basically replacing the oob .js file for related items rendering. If you want to discuss why this is a bad idea, hit me up on twitter or fb.

Wednesday, April 23, 2014

Sorting a view on the Document ID column in SharePoint 2013/Online

I got a request yesterday where a user wanted to be able to sort a list view via the column heading of the Document ID column. Out of the box this is not doable as the column shown is a URL redirect column which is not sortable, and not the Document ID column iteself.

Read more: You can read more about configuring and activating Document IDs at office.microsoft.com

image

I know there are posts out there which shows how to do this in SharePoint 2010 using SPD, but those days are gone. So what’s the approach then? JS Link!

Friday, February 14, 2014

Show announcements the old fashioned way replacing XSLT with JS Link

In my two previous posts (Sample on how to use Content Search to display an announcement list and Creating a custom display template for a content search web part) I showed how to use Content Search in order to bring filtered items back from an announcement list and formatting the result with custom html via display templates.

Topics covered in this post
  • XsltListView web part using JS Link
  • Referencing multiple .js files with JS Link
  • Custom date formatting
While using search is the new cool, there are other ways to accomplish this, which might be just as simple or even better.

In SharePoint 2010 you would have accomplished a custom view rendering using the XsltListView web part, and apply some fancy xslt to it. And this is the approach I’m going to show, except 2013 have added a new kid to the block to replace xslt, namely JS Link. JS Link is just a cryptic name for Display Templates for list views, and is really powerful in the way that you can use it to customize how a view or columns are displayed.

Let’s get to it!

First, edit the page where you want to show the announcements, click the Insert ribbon and click App Part. Then select the Announcement list (or any list other list).

image