Home › Forums › Classic DFFS › Attachment Name
Tagged: Attacment name
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by Alexander Bautz.
-
AuthorPosts
-
-
October 28, 2016 at 15:43 #13867
Hi Alexander,
Before to start thanks for response me the last issues I send. Now I got a question about to show the attachment name instead of attachment image, see the image for references. I know there’s a workaround to show the attachment name in a list view, using jquery (http://sharepoint.stackexchange.com/questions/146353/viewing-my-attachments)Thanks 🙂
Attachments:
-
November 2, 2016 at 00:18 #13909
Hi,
Add this to the “Custom JS”:function getAttName(a,item){ var id = item.get_item("ID"); $.getJSON("/DFFS/_api/lists/getByTitle('vLookup_list_name')/items("+id+")?$select=AttachmentFiles,Title&$expand=AttachmentFiles", function(data) { var b = []; $.each(data.AttachmentFiles,function(i,att){ b.push("<a href='"+att.ServerRelativeUrl+"' target='_blank'>"+att.FileName+"</a><br>"); }); $("#attLoader_"+id).replaceWith(b.join("")); }); return "<img id='attLoader_"+id+"'>"; }
Than add the field “ID” to the “ViewFields” of your vLookup config, and add this to the “Special configuration”:
{"function":"getAttName"}
You must change the “/DFFS” part of the URL with the base url of the site where your vLookup list resides, and the “vLookup_list_name” with the display name of your child list.
Please note that this code will work on SP 2013 only. I can make a snippet for SP 2010 on request.
Alexander
-
November 3, 2016 at 16:38 #13943
Thanks for the code, but am getting the following error “Unclosed string” from JSHint. Let me confirm you i’m been using Sharepoint 2013
Attachments:
-
November 3, 2016 at 18:35 #13946
Hi,
Yes, this code is not right. It might be a browser issue. Do you see the code correctly in the code snippet in my previous post? – maybe you need to paste it in notepad and then cut it from there to ensure any formatting is not messed up.Alexandder
-
November 4, 2016 at 17:22 #13967
Hola,
The code you sent was perfect the problem was the Outlook Email change the code. I took the code from the email and then start the problem.
“+att.FileName+”<br>”
============================================================================
(““+att.FileName+”<br>==============================================================================
Thank for the helpAttachments:
-
November 4, 2016 at 19:37 #13970
Thanks for the feedback – I’m glad it worked out.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.