does anybody know a simple way to make the listview of a document library link to an item (dispform not editform) instead of opening the document on click?
Thanks in advance!
You can add a link to display form by creating new text column on a list and setting following properties on it from code or PowerShell: LinkToItem and LinkToItemAllowed. I don't think those options are available anywhere in GUI in SharePoint 2013.
Example:
SPField field = spList.Fields.GetFieldByInternalName(fieldInternalName);
field.LinkToItemAllowed = SPField.ListItemMenuState.Required;
field.LinkToItem = true;
field.Update();
Doing it this way you don't need Event Receiver.
It seems however that the link generated this way doesn't care about list's settings on whether to open forms in a popup or a page (and always just generates link to a page).
Also, there'sa similar question now: sp2013: Column with link to the displayform like on the title column?
I know this is an old question, but with SharePoint 2013 and Online people might still stumble upon similar problem :)
There is also another option (in 2013) where you can use CSR.
In below js code what I have done is, given the display form link to the Title
column of a document library.
RegisterModuleInit('/SiteAssets/Titlelink.js', updateTitle);
updateTitle();
function updateTitle() {
var priorityFiledContext = {};
priorityFiledContext.Templates = {};
priorityFiledContext.Templates.Fields = {
"Title": {
"View": priorityFiledTemplate
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(priorityFiledContext);
}
function priorityFiledTemplate(ctx) {
var url = String.format('{0}&ID={1}', ctx.displayFormUrl, ctx.CurrentItem.ID);
var ret = "<a href='" + url + "'>" + ctx.CurrentItem.Title + "</a>";
return ret;
}
Hope this also helps.
As I can see, there's no simple way.
I solved the problem using an event receiver generating a column that includes the information to open the popup for the dispform.