Remove Lookup Column Link From View

Applies To: SharePoint 2010

Okay, the title to this post is a little misleading. I won’t be showing how to actually remove the link from the view column. That requires XSLT or JavaScript. What I will show you is a work around that is good enough for me and requires nothing but the browser.

When you add a Lookup Column to a list the linked item’s display form will automatically be linked to the column wherever it shows up in a view. Generally, this is pretty awesome behavior since it gives more detail on demand without us having to do anything. Sometimes, however, these links can get in the way. This is especially true when you have more than one lookup column in a view or when you don’t want people to get confused about which link to click.

In SharePoint 2010 you can include additional fields with your lookup. So for this workaround we’re going to simply have the same reference column also be an additional field for the lookup. This allows us to choose the additional field for our view. Got it? How about an example.

Say we have a lookup column named Position that references our Positions list. We choose Title for the display field for our lookup:

This works great because it gives us a nice drop down of all the available positions for people to choose on our new and edit forms. But then when you go to create a simple view you might run into this issue:

That’s part of our view for our list. So, which link do you click on? The Position link will open the display form for the Positions list item Associate Manager. The Job Type link will open the display form for the current list item. And my head just exploded.

So our goal is to keep the Position column showing Associate Manager but without the link to the secondary list. We also don’t want to use any JavaScript or have to edit this view with custom XSLT.

So, go back to the Lookup Column and in the Additional Fields section check the box next to the same column used in the lookup (Title in this example):

This adds a new column to our list called Position:Title. So now we edit our view to use the new column in place of the lookup:

As you can see, this takes care of our problem. The user is still only presented with the one dropdown when using the edit/new forms to pick the position and our view now has no hyperlink to the secondary list’s item display form. But what about that stupid column name?

Going back to our List Settings you can click on the Position:Title column and change the column name. Obviously, selecting the same name as the lookup will get you an error:

So don’t do that. The best move is to give it another name, but you can also use a little trick. Just add a space after the name so the column name becomes “Position “. You can save this and since you already put it in your view it looks perfect:

Of course, editing the columns or messing with additional views can get confusing when columns names look exactly the same – so use at your own discretion.

Display Form Link/Menu on Column Other Than Title

Applies To: SharePoint 2010

By default, the Title column in a list can be shown in a view in three different ways:

  • Title
  • Title (linked to item with edit menu)
  • Title (linked to item)

Often you can just rename the Title column to whatever you want to have that functionality and you’re good to go. However, sometimes you want the link and/or menu on a different column. Unfortunately, this isn’t an option in the View editor within the browser. Fortunately, it can easily be done in SharePoint Designer without having to mess with XSLT at all.

Simply modify your view in SharePoint Designer:

Switch to the code view and scroll down to the purple section (you can only edit the yellow highlighted text in advanced mode – which we do NOT need to do here).

Link To Display Form

In the ViewFields section are a bunch of FieldRef elements. Find the one you want and add LinkToItem=”TRUE” and save. So your ViewFields section might look something like this:

<ViewFields>
	<FieldRef Name="SomeField1" LinkToItem="TRUE" />
	<FieldRef Name="SomeField2"/>
	<FieldRef Name="SomeField3"/>
</ViewFields>

In the above example, SomeField1 will now have a hyperlink that will open the display form for the list item.

Link To Display Form With Menu

This is pretty much the same as above except the attribute name is different. In the ViewFields section are a bunch of FieldRef elements. Find the one you want and add ListItemMenu=”TRUE” and save. So your ViewFields section might look something like this:

<ViewFields>
	<FieldRef Name="SomeField1" ListItemMenu="TRUE" />
	<FieldRef Name="SomeField2"/>
	<FieldRef Name="SomeField3"/>
</ViewFields>

In the above example, SomeField1 will now have a hyperlink that will open the display form for the list item and a drop down menu for choosing actions.