I have a custom Sharepoint list with attachments enabled. This allows me to upload a number of attachments which display with most recently uploaded files on top. While I know it is not possible to have two attachments columns for a list in Sharepoint, what I do wonder is if it is possible to 'organize' the uploaded files in such a way to create a separation between files so they don't appear in one big unordered list as if there were two attachment columns. I hope my questions is clear, if not I will be happy to clarify! Thanks in advance!
2
-
Are you looking for attachments to display in 2 columns format versus 1 column format? – Venkat Konjeti Jun 8 '17 at 16:09
-
@VenkatKonjeti Two columns would be fine, as long as I could somehow control which attachments appear in each column. The goal is when someone views the details of a list item, that they would see two separate 'lists' of attachments. One 'list' would have attachments pertaining to a certain subject, while the other 'list' would have the attachments pertaining to a different subject. – dak1220 Jun 8 '17 at 16:14
Add a comment
|
You can customize the Display Form or Field on a form using CSR. This will be used to render your field as designed but you have to decide how to categorize your attachments.
The Syntax would be as follows
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
'Attachments': {
DisplayForm: function(ctx) {
var html= '';
var attachments = ctx.CurrentItem.Attachments;
if(attachments != null) {
html = "<ul>";
for(var i = 0; i < attachments.Attachments.length; i++) {
html += ("<li>" + attachments.Attachments[i].FileName + "</li>");
}
html += "</ul>";
}
}
}
}
}
});
You can refer this article which explains with an example.
Let me know if you need further help.