now i tried this JSLINK , and it worked :-
(function () {
(window.jQuery || document.write('<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.0.min.js"><\/script>'));
var linkFieldContext = {};
linkFieldContext.Templates = {};
linkFieldContext.Templates.Fields = {
"Attachments": { "View": AttachmentsFieldTemplate }
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(linkFieldContext);
})();
function AttachmentsFieldTemplate(ctx) {
var listItemId = ctx.CurrentItem.ID;
var listName = ctx.ListTitle;
return getAttachments(listName, listItemId);
}
function getAttachments(listName,listItemId) {
var url = _spPageContextInfo.webAbsoluteUrl;
var webServiceUrl = url + "/_api/web/lists/getbytitle('" + listName + "')/items(" + listItemId + ")/AttachmentFiles";
var attachHtml = "";
$.ajax({
url: webServiceUrl,
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
async: false,
success: function (data) {
for(var i = 0; i < data.d.results.length; i++) {
attachHtml += "<a href='" + data.d.results[i].ServerRelativeUrl + "'>" + data.d.results[i].FileName + "</a>";
if (i != data.d.results.length - 1) {
attachHtml += "<br/>";
}
}
},
error: function (error) {
console.log(error);
}
});
return attachHtml;
}
but the problem i am facing is that when i click on the list view i will get the following error for a couple of seconds, then the page will refresh automatically and show the attachments correctly:-
so is there a way to overcome this temporary error message which is being displayed??