Override LinkFilename with Title

Dear all,

within the view of a SharePoint 2013 document library, I show these two columns (amongst others):

  1. LinkFilename - "Name (linked to document with edit menu)", e.g. "filename1"
  2. Title, e.g. "This is my title of interest"

I want to replace the text of the LinkFilename column with the value of the title column so that I can remove the title column.

Background:

The filename itself is of no interest for the users, only the title is. But the title has neither a link to the file nor an edit menu.

My Approaches:

When using the following JS using JSLink I managed to replace the text, but also the link to the file was gone (obviously):

(function () { 
    var overrideNameField = {}; 
    overrideNameField.Templates = {}; 
    overrideNameField.Templates.Fields = {
        "LinkFilename": { "View": overrideNameFieldTemplate } 
    }; 

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideNameField); 
})(); 

function overrideNameFieldTemplate(ctx) { 

    var title = ctx.CurrentItem.Title; ctx.currentItem

	return title;
} 

The second approach was overriding the title column with the link to the file.

Unfortunatlely this lead to the issue, that the IE dialogue "Open Document" (How would you like to open this file: Read Only / Edit) did not show up (and all Office files would open in read-only mode).

(function () { 
    var overrideNameField = {}; 
    overrideNameField.Templates = {}; 
    overrideNameField.Templates.Fields = {
        "Title": { "View": overrideNameFieldTemplate } 
    }; 

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideNameField); 
})(); 

function overrideNameFieldTemplate(ctx) { 

    var title = ctx.CurrentItem.Title; 
    var fileRef = ctx.CurrentItem["FileRef"];
    var fileLeafRef = ctx.CurrentItem["FileLeafRef"];

    if (title) {
        return "<a href='"+ fileRef + "'>"+ title + "</a>"; 
    }
    else {
        return "<a href='"+ fileRef + "'>"+ fileLeafRef + "</a>"; 
    }
} 

I prefer a solution with JSLink (client-side rendering).

Any help is appreciated.

TIA

January 23rd, 2015 4:08pm

try using event receiver use intername for linkedtotitle and replace it with titles content

http://sharepoint.stackexchange.com/questions/53594/linkfilename-display-text-from-other-field

http://sharepoint.stackexchange.com/questions/72485/internal-name-for-the-namelinked-with-document-with-edit-menu-field-sharepoint

---------------------------------------------------------------------------------------------------------------------------

Please mark as answer if you find it useful else vote for it if it is close to answer..happy sharepointing

Free Windows Admin Tool Kit Click here and download it now
January 26th, 2015 12:59pm

Hi,

According to your description, my understanding is that you want to replace LinkFilename column text with the title column text using JSLink.

Your second approach is available.

If you want to get the Link to Item with Open Document Menu functionality on a field,you can use ListItemMenu attribute in a field to achieve it.

<FieldRef Name='Title' ListItemMenu='TRUE' />

Here is a similiar thread for your reference:

http://sharepoint.stackexchange.com/questions/97692/jslink-render-fileleafref-with-title-in-document-library

Best Regards

January 27th, 2015 7:20am

Sorry, but in my view, this is not the answer we are looking for. This merely adds the drop-down menu, but what we really want is to make the Title text link to the actual document, just the same as "Name (linked to document with edit menu)" would.

Clicking a such linked Title should show the question about read-only or edit (checkout):

Adding

ListItemMenu="TRUE"

to the Title does only the bold part of what we want, it adds the drop-down edit menu. What is still missing is the bold italic part, the link to the document.

And before anybody posts it, let me state that at least for me (Sharepoint 2010), adding

LinkToItem="TRUE"

does not help, either. And neither does one more property or the combination of both:

LinkToItemAllowed="Required"
We do get the Title linked that way, but what happens on clicking the link is a pop-up:

Pop-up to edit document properties

It gives access to the properties of the document, to version history and check-out, and again to the Name, linked to the actual document.

Clicking that further link, Name, finally opens the document. However, it opens the document forcibly read-only, without the prompt for read-only or edit (checkout). So, this time, the link on Name does not do the same as if we had "Name (linked to document with edit menu)" directly in the view.

Sorry to be verbous, but it seems needed to make the point clear.

Summary

  • We would like to have something like "Title (linked to document with edit menu)" similar to the standard "Name (linked to document with edit menu)".
  • In fact, it should not only work for Title, but for any property, also custom added ones.
  • The edit menu part can be solved via adding ListItemMenu="TRUE" to Title or custom properties.
  • The particularly difficult part seems to be a real link to the document, opening the document after showing the prompt for read-only or edit (checkout).

Anybody has a clue?

Free Windows Admin Tool Kit Click here and download it now
April 8th, 2015 8:49am

Same issue and following. Do not know why this is not a standard offering with the need to use CamelCase or underscores or something to not have %20 in the URL.  End users and user adoption are NOT the focus apparently.
July 10th, 2015 12:20pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics