40

How can I change the column in a SharePoint list that has the link to the item and the link to the item with edit menu eg:

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

I want to have a different column with the link. I want to do this without any workaround like renaming the Title to the other column that I want and copying the content into it.

Thanks

4 Answers 4

35
  1. Open the AllItems.aspx page for the specific list.
  2. Search for the <ViewFields> tag
  3. List item LinkToItem="TRUE" to whichever column you want the link:

<ViewFields><br/>
    <FieldRef Name="Attachments"/><br/>
    <FieldRef Name="LinkTitle"/><br/>
    <FieldRef Name="linkThisColumn" LinkToItem="TRUE"/><br/>
    <FieldRef Name="data_x0020_column"/><br/>
    <FieldRef Name="Another_x0020_column"/><br/>
</ViewFields><br/>
1
23

If you're trying this for SharePoint 2013, change "LinkToItem" to "linkToItem"

<ViewFields><br/>
    <FieldRef Name="Attachments"/><br/>
    <FieldRef Name="LinkTitle"/><br/>
    <FieldRef Name="linkThisColumn" linkToItem="TRUE"/><br/>
    <FieldRef Name="data_x0020_column"/><br/>
    <FieldRef Name="Another_x0020_column"/><br/>
</ViewFields><br/>
2
  • 2
    Note: If you Modify View after this through UI (Library>Modify View) attribute will be lost in AllItems.aspx page.
    – Marko Tica
    Commented May 4, 2015 at 8:40
  • Also for SP 2013, set listItemMenu="TRUE" for the edit menu.
    – Nattrass
    Commented May 8, 2017 at 13:14
12

You can use LinkToItem, LinkToItemAllowed and ListItemMenu properties of SPField. If you want field to show link to item's display form you need to set LinkToItem property to true and LinkToItemAllowed property to Allowed. If you want to add context menu to field you need to set ListItemMenu to true.

12

Do you try [this solution][1]? In this solution you should modify field declaration on a view through SharePoint Designer.

You can hide the “Title” field first by going to List Settings > Advanced Settings > Content Types > set Allow Management of Content Types to Yes. This will open Content Types under the List Settings.

Then go back to the List Settings > Content Types > click on Title and set it to Hidden.

Now to link the Item to a specific column/field, you need to open the list in SPD and look for the following tags:

<ViewFields>
<FieldRef Name="Field1"/>
<FieldRef Name="Field2"/>
<FieldRef Name="Field3"/>
<FieldRef Name="Field4"/>
<FieldRef Name="Field5"/>

Let’s say you want the Item to open when you click on “Field1″. Just add LinkToItem=”TRUE” tag on it:

<ViewFields>
<FieldRef Name="Field1" LinkToItem="TRUE"/>
<FieldRef Name="Field2"/>
<FieldRef Name="Field3"/>
<FieldRef Name="Field4"/>
<FieldRef Name="Field5"/>

Save it and you’re done. [1]:

3

Not the answer you're looking for? Browse other questions tagged or ask your own question.