how to see all attachments at the top of form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2014 01:20 PM
I'm in form view, and have a lot of attachments on the record. So many attachments that the list at the top cannot display all the attachments. What I can do is manipulate the DOM and change the height of the div to show more.
change ... <div id="header_attachment" style="display: block; width: 100%; overflow: hidden; height: 1.4em;">
to ... <div id="header_attachment" style="display: block; width: 100%; overflow: hidden; height: 6.4em;">
I can also change the overflow to be overflow: scroll or overflow: auto. This will provide scroll bars to let me see all the attachments. What I want to know is what is the correct way to see all the attachments? Is there a property to show all? Thanks!
Joe
- Labels:
-
Enterprise Release Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2014 01:34 PM
Joseph,
Have you tried adding the attachments related list to the bottom of the form? Any reason why you couldn't use that?
Thank you,
Marcus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2014 01:35 PM
Depending on the table you should be able to add a Related List for Attachments. I had the same issue with RFC's and added the Related List. I then did this on all of our regular forms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2014 09:33 AM
Yes, I know I could use a related list to show all of these. Unfortunately our process owners preferred to use the existing functionality of seeing the attachments at the top of the form. After looking into this more all the attachments are actually there and already on what would appear to be the correct row, however the height of the div does not expand to include all the attachments. Additionally the overflow is not set to use a vertical scroll to let the user scroll through all the attachments.
Anyways, below is the function I've created. This is called onLoad and I also have it in a UI script. What this does is set the height of the div to either show 1, 2 or 3 rows of attachments, but no more. If the number or rows exceeds 3 then scroll bars will show.
For my company this is quite rare to have more than 3 rows of attachments however if this rare case is encountered then the user can see the all attachments without having to click the Manage Attachments link.
/////////////////////////////////////////////////////////////////
// Description: Shows the entire list of attachments at the top of
// the form. By default this list is minimized and all attachments
// are not visible. This will keep the maximum amount of visible rows
// to three.
/////////////////////////////////////////////////////////////////
function showAttachments() {
// determine the number of rows to expand
// do not expand past the max
// if expanding past the max is needed then add a scroll
var attachments = $$("div[id=header_attachment] li[class=attachment_list_items]");
if (attachments.length <= 0)
return;
// determine the number of rows to show
var rowMax = 3;
var rowCnt = 1;
var offsetTop = attachments[0].offsetTop;
var divHeight = offsetTop + attachments[0].offsetHeight;
for (var i=0; i < attachments.length; i++) {
// use offsetTop to determine when we are on a new row
if (offsetTop != attachments[i].offsetTop) {
offsetTop = attachments[i].offsetTop;
if (rowCnt < rowMax) {
divHeight = offsetTop + attachments[i].offsetHeight;
}
rowCnt++;
//console.log('JOE rowCnt: ' + rowCnt + ' divHeight: ' + divHeight);
}
}
//console.log('JOE rowCnt: ' + rowCnt + ' divHeight: ' + divHeight);
// do not show more rows than the max
// add a scroll if the number of rows exceeds the max
var attachmentHdrList = $$("div[id=header_attachment]");
if (attachmentHdrList.length <= 0)
return;
var attachmentHdr = attachmentHdrList[0];
if (rowCnt > rowMax) {
attachmentHdr.style.overflow = "auto";
}
// set the height of the div to show the rows
attachmentHdr.style.height = divHeight + "px";
// handle the div element (...)
// removing this element will cause the context menu to stop showing
// additionally the display style at the time of onLoad is not set and will be overwritten
// the only thing to do to make this invisible is to set the innerHTML to an empty string
var moreElmt = document.getElementById("more_attachments").innerHTML = "";
}