Changing Title Column Heading on SharePoint List

Posted: 11th May 2011 in Deployment, SharePoint, Sharepoint 2010

Scenario: You want to us the inherited title field in your list definition,but you don’t want it to be called title.  To override what is displayed in the new/edit form is straight forward enough. You just add the DisplayName attribute to your Title FieldRef with the ID of {fa564e0f-0c70-4ab9-b863-0177e6ddd247} in the Content Type.

Overriding Title Display Name
  1. <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="New name" Required="FALSE" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />

This is great and easy to achieve. However, you are still left with the column heading of Title in the list. This can be changed manually through the UI, but if you are constantly deploying that is not a solution.

To try and resolve this issue I changed the display name of the field ref in the view, but, as far as I can see, this does nothing at all. 

List Definition View Field
  1.   <FieldRef Name="LinkTitle" DisplayName="New Column Header">
  2.           </FieldRef>

In the end, I changed it manually and viewed the whole schema using SharePoint Manager 2010 . I discovered among the Schema.xml that SharePoint adds a computed column for the link title with the display name I added.

So, in essence, if you want to change the Title column value of a View add this to the fields section of the Schema.xml of the Definition.   

Overriding Title Heading XML
  1. <Field ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" ReadOnly="TRUE" Type="Computed" Name="LinkTitle" DisplayName="New Column Header" DisplayNameSrcField="Title" ClassInfo="Menu" AuthoringInfo="(linked to item with edit menu)" ListItemMenuAllowed="Required" LinkToItemAllowed="Prohibited" SourceID="" StaticName="LinkTitle" FromBaseType="TRUE">
  2.         <FieldRefs>
  3.           <FieldRef Name="Title" />
  4.           <FieldRef Name="LinkTitleNoMenu" />
  5.           <FieldRef Name="_EditMenuTableStart2" />
  6.           <FieldRef Name="_EditMenuTableEnd" />
  7.         </FieldRefs>
  8.         <DisplayPattern>
  9.           <FieldSwitch>
  10.             <Expr>
  11.               <GetVar Name="FreeForm" />
  12.             </Expr>
  13.             <Case Value="TRUE">
  14.               <Field Name="LinkTitleNoMenu" />
  15.             </Case>
  16.             <Default>
  17.               <Switch>
  18.                 <Expr>
  19.                   <GetVar Name="MasterVersion" />
  20.                 </Expr>
  21.                 <Case Value="4">
  22.                   <HTML><![CDATA[<div class="ms-vb itx" onmouseover="OnItem(this)" CTXName="ctx]]></HTML>
  23.                   <Field Name="_EditMenuTableStart2" />
  24.                   <HTML><![CDATA[">]]></HTML>
  25.                   <Field Name="LinkTitleNoMenu" />
  26.                   <HTML><![CDATA[</div>]]></HTML>
  27.                   <HTML><![CDATA[<div class="s4-ctx" onmouseover="OnChildItem(this.parentNode); return false;">]]></HTML>
  28.                   <HTML><![CDATA[<span>&nbsp;</span>]]></HTML>
  29.                   <HTML><![CDATA[<a onfocus="OnChildItem(this.parentNode.parentNode); return false;" onclick="PopMenuFromChevron(event); return false;" href="javascript:;" title="Open Menu"></a>]]></HTML>
  30.                   <HTML><![CDATA[<span>&nbsp;</span>]]></HTML>
  31.                   <HTML><![CDATA[</div>]]></HTML>
  32.                 </Case>
  33.                 <Default>
  34.                   <HTML><![CDATA[<table height="100%" cellspacing="0" class="ms-unselectedtitle itx" onmouseover="OnItem(this)" CTXName="ctx]]></HTML>
  35.                   <Field Name="_EditMenuTableStart2" />
  36.                   <HTML><![CDATA["><tr><td width="100%" class="ms-vb">]]></HTML>
  37.                   <SetVar Name="ShowAccessibleIcon" Value="1" />
  38.                   <Field Name="LinkTitleNoMenu" />
  39.                   <SetVar Name="ShowAccessibleIcon" Value="0" />
  40.                   <HTML><![CDATA[</td><td><img src="/_layouts/images/blank.gif" width="13" style="visibility:hidden" alt=""/></td></tr></table>]]></HTML>
  41.                 </Default>
  42.               </Switch>
  43.             </Default>
  44.           </FieldSwitch>
  45.         </DisplayPattern>
  46.       </Field>

Not, rocket science, but a bit of a pain…


Leave a Reply

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

You are commenting using your 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