You are currently browsing the daily archive for September 1st, 2008.
When dealing with hyperlinks in SharePoint, users often point out the two following limitations:
- in a links list, there is no option to open a link in a new window.
- When using calculated columns to build URLs, the result is not displayed in a user-friendly way.
There are various methods to work around these limitations. Today I am going to show mine, which has the advantage of only using the SharePoint UI (no need for SharePoint Designer).
Color coding is very useful to highlight key items in a list. For example in an issues list, you may want to draw the users’ attention on items with high priority.
In the picture below, I have aggregated 4 different ways to do it:

This customization was entirely done through the SharePoint UI. Let’s see how.
Update [6/8/2009]: A new version of the script is now available, more details here.
Updates
I am now expanding the scope of this method:
- list views (flat views and expanded grouping): this article
- list views (collapsed grouping): this article
- display forms (DispForm.aspx): published on 10/01/2008
- calendar views: published on 11/15/2008
- using calculated columns to write scripts: published on 2/26/2009
- preview panes: added on 7/9/2009
- filters: not published yet
Also note the troubleshooting section.
Update [09/10/2008]
I have added a few lines to the initial script to address the case of collapsed views. Also, see my note at the end of this post.
Your feedback is important to me. Big thanks to Fernando, Jeff and the others who reported the limitations of the initial version!
A technical note: considering that 1/ the script is generic and 2/ it may still evolve in the future, a good practice is to store it in a separate text file on your site. You can then link to it from any Content Editor Web Part by using the “Content link” box.
I have already introduced calculated columns in a previous post.
One of their limitations is that the output is just text. Sometimes your browser will be smart enough to interpret the text as a hyperlink – when you calculate an e-mail address or a URL for example. Nevertheless in this case the display is usually not user-friendly. This will never allow you to get what a “Hyperlink or Picture” column does, for example.
To extend the possibilities of calculated columns, my idea is to use them to write HTML instead of just text, thus allowing some additional formatting. In this post I am going to show how to achieve this result through a generic method, combining calculated columns and the Content Editor Web Part.

Recent Comments