Hello,
I have created a custom list view, with JSLink, for announcements list which I use it as FAQ view.
My problem is that I can't show attachments link.
I tried to implement it like in DispForm.aspx but no luck.
Javascript code:
(function () { var accordionContext = {}; accordionContext.Templates = {}; accordionContext.OnPostRender = accordionOnPostRender; accordionContext.Templates.Item = accordionTemplate; SPClientTemplates.TemplateManager.RegisterTemplateOverrides(accordionContext); })(); function accordionTemplate(ctx) { var title = ctx.CurrentItem["Title"]; var description = ctx.CurrentItem["Body"]; var attachments = ctx.CurrentItem["Attachments"]; // Return whole item html return "<tr>" +"<td colspan='13'>" +"<h2 class='heading' style='margin-bottom:0; font-size:16px;color:#2887dc'>" + title + "</h2>" +"<div class='content' style='white-space: -moz-pre-wrap;'>" + description +"<table><tr id='idAttachmentsRow' style='display: table-row;'>"+"<td class='ms-formbody' id='SPFieldAttachments'><table border='0' cellpadding='0' cellspacing='0' id='idAttachmentsTable'><tr><td><span>" + attachments + "</span></td></tr></table></td>" +"</tr></table>" + "</div>" +"</td>" +"</tr>"; } function accordionOnPostRender() {
// if (typeof ShowAttachmentRows == "function") ShowAttachmentRows(); $(".content").hide(); //toggle the componenet with class msg_body $(".heading").click(function () { $(this).next(".content").slideToggle(500); }); $('.heading').css('cursor', 'pointer'); }
Is there any way you can show attachments in custom List View like in DispForm.aspx?
Thanks in advance
Giorgos