Customize Look And Feel With Calculated Columns


Ever wanted to ‘Color Code’ a SharePoint calendar? Or have certain list items display differently then other list items based on their column values?

One of those things that every user needs is the ability to customize the look and feel of many SharePoint elements, and sometimes it just doesn’t make sense to wait for a SharePoint team, developers, or architects to work out a long term solution.

Sometimes you just need a quick and dirty way of doing something as a one off to illustrate a point or to deal with a situation while you work out the full solution.

My favorite ways of dealing with most of these things is the use of codeplex projects, jQuery, javascript, content editor webparts, and SharePoint Designer which I post pretty often about. It’s quick, normally easy to reverse, and can often be managed by a business user.

Another personal favorite of mine is a method that (to my knowledge) Christophe came up with using calculated columns, some conditions, simple HTML and a bit of JavaScript. All of which turns into completely customized (look and feel) views of lists. (Read his original article here: http://pathtosharepoint.wordpress.com/2008/09/01/using-calculated-columns-to-write-html/)

The concept is simple:
Using SharePoint calculated columns create conditional statements that display different HTML based on the value of the column. Then (because of how it is rendered) use JavaScript to transform the rendered content to it’s equivalent HTML.

The power of this is that it can apply to a great many different scenarios. Take for example one of the common requirements of ‘color coding’ a calendar. In Christopher’s post last november he cleverly illustrates exactly how you could do this with relatively little effort: http://pathtosharepoint.wordpress.com/2008/11/15/sharepoint-calendars-color-coding-hover-effects-etc/

image

This is a simple and effective way to deal with many look and feel issues quickly and easily. If used with a bit of direction this can really help users understand, consume, and review information much more quickly.

image

(Above image from another example of how it can be used: http://pathtosharepoint.wordpress.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/)

Update: Adorable little calculated column builder (based on what I describe in this post) – http://www.pathtosharepoint.com/HTMLcc/default.aspx. Could save you a bit of time.

Hopefully with a glance at some of these you can begin to see the usefulness and power such a method can provide for your SharePoint deployment, I know I use it fairly often and I am sure you will too,
Richard Harbridge

Advertisements
Explore posts in the same categories: News and Opportunities, Reference, SharePoint 2007, Tips and Tricks, Workaround

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

3 Comments on “Customize Look And Feel With Calculated Columns”


  1. […] Customize Look And Feel With Calculated Columns […]

  2. Paolo Says:

    Nice and works well, but (there’s always a “but” 🙂 ) while the calculated columns dont’s show while editing a record, they show up when you choose “view”, with all that HTML code and calculations.
    Is there any way to prevent those particular columns from showing up while “viewing” the record? Thanks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: