1

I have a list which has employee IDs as a field. I then have a calculated column which takes this field and uses it to link to our company-wide employee directory. This means I can hide the employee ID field and just show the link to the directory, which is just fine.

However, if someone wants to filter on the calculated column and view all the information about a particular person, they view the whole HTML and Javascript used, e.g.:

<a href='#' onClick="window.open"... 

etc

This is obviously fairly useless for filtering. Is there a way to make it render plain text in a drop down for filtering?

Note: Using Sharepoint 2010

  • Are you using SharePoint 2010 or 2013? – Nadeem Yousuf Apr 1 '14 at 8:49
  • @NadeemYousuf: Sharepoint 2010 – Andrew Martin Apr 1 '14 at 8:55
  • @AndrewMartin When you say "ID field", are you referring to the native ID column? If so, how could you have used it in a calculated column? – MdMazzotti Apr 1 '14 at 10:53
  • @MdMazzotti: No, not the native ID field. It's an employee ID field, which are 9 digits long and unique. – Andrew Martin Apr 1 '14 at 10:54
  • @AndrewMartin instead of using a calculated column, can't you just customize the xslt view? In this way, you can have the filter on the ID column and each item formatted as an <a> tag – MdMazzotti Apr 1 '14 at 10:59
1

Create a new view for your list (either from SPDesigner or the browser UI) and make it the default.

Now, in SPDesigner, go to Lists and Libraries > your list > Views > Right click on the new view and Edit file in advanced mode.

In Split mode, hover the mouse over the first EmployeeID field value, then click right before it and enter some dummy text (see the screenshot) -this is a trick to make SPDesigner remove the ddwrt:ghost attribute.

enter image description here

Now, replace the dummy text with the following markup:

<a href="http://www.yourlink.com?id={$thisNode/@EmployeeID}">
   <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping ="yes"/>
</a>

Save and test.

  • Apologies! Work took over and things got busy. Thank you. This solution is fantastic :) – Andrew Martin Apr 2 '14 at 7:36

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.