Not working in list view with filter

Mar 12, 2014 at 6:16 PM
Edited Mar 12, 2014 at 6:20 PM
works fine with normal list view but when filter is applied to list view, then javascript is rendered instead of link.

below text will appear in the column instead of attachment links

<script type="text/javascript" src="/_layouts/SP2010.Controls.AttachmentField/jquery-1.8.2.min.js" mce_src="/_layouts/SP2010.Controls.AttachmentField/jquery-1.8.2.min.js" ></script><script type="text/javascript"> var listname='{0733A489-96FF-450E-99EC-3DBB16290D8A}'; var currentWeb='http://server'; $(document).ready(function() { var soapEnv ="<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\ <soap:Body>\ <GetAttachmentCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/'>\ <listName>"+listname+"</listName>\ <listItemID>1</listItemID>\ </GetAttachmentCollection>\ </soap:Body>\ </soap:Envelope>"; $.ajax({ url: currentWeb + "/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, async: true, complete: processResult0, contentType: "text/xml; charset=\"utf-8\""}); }); function processResult0(xData, status) { $("#data_1").empty(); $(xData.responseXML).find("Attachment").each(function() { $("#data_1").append("<img src=\"/_layouts/images/attachhd.gif\" ><span style=\"position:relative;top:-4px;\"><a href='"+$(this).text()+"'>" +GetFilename($(this).text()) + "</a></span></img></br>"); }); if(!$("#data_1").html()) { $("#data_1").append("<img src=\"/_layouts/images/info16by16.gif\" /> <span style=\"position:relative;top:-4px;\">No attachments</span>"); } } function GetFilename(path) { var last_index = path.lastIndexOf('/'); return path.substring(last_index+1, path.length); } </script><div id="data_1"><img src="/_layouts/images/SP2010.Controls.AttachmentField/Kpiprogressbar.gif"></div>