13.09.2014 v1.71 fixes a bug where the attachment have an apostrophe in the name.
05.06.2012 v1.7 adds support for jQuery v1.7.x.
I have previously posted a solution for listing all attachments when clicking on the paper clip in a list view, you find it here.
This is an updated version with a few new features – and SharePoint 2010 support. I post it in a new article to keep it tidy.
The new features are:
- Option to display the attachments on hover.
- Shows the icon and the file name.
Put the code in a ContentEditorWebPart (CEWP) below the list view.
There are two different scripts, one for SharePoint 2007 and one for SharePoint 2010, but the CEWP code is shared.
I have referred jQuery from Google. If you prefer a local copy, you find the file here.
The argument object is an object literal with these attributes:
- hideIdColumn: true to hide the ID column, false to leave it visible.
- clickToOpen: true to open the list by clicking, false to open it on hover.
- clickMouseover: If the previous attribute is set to true, this is the text shown when the mouse hovers over the paper clip.
- oneClickOpenIfSingle: true to open a single attachment directly, false to list it. This requires the attribute “clickToOpen” to be set to true.
Ensure you pick the correct version – for SharePoint 2007 or SharePoint 2010. You find the file “ListAttachments.js” here
Please post any bugs below.