We all know that new documents added to a library automatically get the !NEW icon listed with the name (filename). But what if you want the !NEW icon displayed with another column value or want to use the more useful Title column as the document link instead of file name?
The file name is what links to the document by default, not the title, and that's not always what we prefer to display. This thread walks you through changing the link from Name to Title and adding the !NEW icon to the Title instead of the default Name field.
First, create the view you want for your library, such as adding Title to be a display column and possibly removing Name from the view. For this example, let’s modify the All Documents view on that library to include the Title column. In SharePoint Designer, go into the Forms folder for the library and open the AllItems.aspx file (or the view you’ve created). This file manages the specific view created and each view will have its own file. The image below shows the AllItems.aspx page (the All Documents view) from within the document library named test.
The file name is what links to the document by default, not the title, and that's not always what we prefer to display. This thread walks you through changing the link from Name to Title and adding the !NEW icon to the Title instead of the default Name field.
First, create the view you want for your library, such as adding Title to be a display column and possibly removing Name from the view. For this example, let’s modify the All Documents view on that library to include the Title column. In SharePoint Designer, go into the Forms folder for the library and open the AllItems.aspx file (or the view you’ve created). This file manages the specific view created and each view will have its own file. The image below shows the AllItems.aspx page (the All Documents view) from within the document library named test.
In order to modify the view’s headings, you must convert the view to XSLT data view. With Designer in split mode, right-click on the view to bring up the menu shown below, and click on Convert to XSLT Data View.
Once the conversion is complete, click on the Title filed to find the code that displays that field. Add the following code per the screenshot below to add the !NEW icon to the Title field:
<xsl:if test="ddwrt:IfNew(string(@Created))"><img src="/_layouts/1033/images/new.gif" alt="New" /></xsl:if>
If you left the Name column in the view, this code will already exist with that heading, so simply cut from there and past into the Title heading as shown below.
No comments:
Post a Comment