Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

SP2010. I have a list that works fine, and I don't want to modify or rename any of it's columns. Why? I've got plenty of Ajax queries hitting that list, and don't want to break what works.

But, this same list, when rendered in a view for human consumption, has of course, the list column titles, which are not at all what I'd like to show. The list has a few lookup columns, so some column titles are rendered as "myLookupColumn:SomeOtherField". Ugh.

A cursory search here and google reveals there isn't a simple "Display Title" that can be set for list view columns, so I looked at doing an XSL transform. I didn't see how to accomplish this, but I cannot help but think it should be possible.

I'm also up for brute-force changing the column titles by writing a custom jQuery function, but that seems like a rather inelegant solution.

Is there a better way to set customized column titles for a list view?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The rendering of column headers could be customized using XSLT.

The method described here represents one of the possible ways how it could be accomplished using SharePoint Designer (SPD)

Solution

In SharePoint Designer (SPD) open view page in Designer Mode. Select list header in List View that have to be customized and then click Customize Item as shown on picture below

enter image description here

Switch to Code Mode and find template for column header generated by SPD

<xsl:template name="FieldRef_header.Continent_x003a_Title" ddwrt:dvt_mode="header" match="FieldRef[@Name='Continent_x003a_Title']" mode="header" ddwrt:ghost="show" xmlns:ddwrt2="urn:frontpage:internal">
<!-- your rendering code goes here-->
</xsl:template>

Pay attention to the following template attributes:

mode="header" - correspond to rendering mode for header

match="FieldRef[@Name='Continent_x003a_Title']" - matching attribute for field corresponds to field internal name

Replace generated code for rendering field title:

        <xsl:with-param name="fieldtitle">
          <xsl:value-of select="@DisplayName"/>
        </xsl:with-param>

with the following one:

        <xsl:with-param name="fieldtitle">
              Continent Name 123
        </xsl:with-param>

After these changes the resulting page should like the shown below

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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