SharePoint 2010 - Add "Show List Item Menu" and "Show Link to Item" to a custom column

While I am building new employee SharePoint custom list in my workplace, I have encountered a strange problem. By default, the Title field is used to bring item context menu as well as be a clickable link to open the item in dialog box. I could not find a solution in SharePoint interface to make this change from Title to another column, in my case, Full Name.



Initially, I thought I could change this default behavior by creating a custom view, but there was no option to change it. While asking the same question to my good friends in google and bing, I got a hint from Stackexchage discussion forum. In fact, the solution was pretty easy. Let me explain this in my own words:

  1. Create a new custom view for your custom list. In my case, it is called "Custom Test View 1" and it only displays Full Name and Title.
  2. Select Site Action - Edit Page. Then, click on List tools / List ribbon item. You can click on Edit List in SharePoint Designer icon as shown below:

  1. If you don't have SharePoint 2010 Designer installed, you can download it from Microsoft site. This software is free.
  2. Click on your custom view, in my case, "Custom Test View 1".


  1. Once you are in edit mode, switch your view to Code and click on Advanced Mode icon from ribbon menu. Now you are ready to change the default behavior.
  2. First, locate ViewFields tag in the code. You will see something like shown below:
  1. Change FieldRef as shown below. What I did was to add LinkToItem and ListItemMenu attributes to Full Name field and rename Title field name from LinkTitle to Title.


You are done. I think I can add "link to menu" option to any column by simply adding LinkToItem and ListItemMenu attributes in the view. In addition, Title and LinkTitle are referring to the same field content except LinkTitle has been already configured with LinkToItem and ListItemMenu attributes. I could be wrong since I am not sure about internal working of SharePoint 2010, but this trick worked for me to solve my problem.



Comments

  1. I'm trying your solution now in a custom doc library view (boxed). So far, it doesn't seem to take.

    ReplyDelete
    Replies
    1. Whoops! I stand corrected. It works, just not like I was expecting. :) I was expecting a dropdown listbox with options.

      Delete

Post a Comment

Popular Posts