修改list中附件排序(sharepoint 2010)

修改文件C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx

添加以下js:

<script type="text/javascript">


//获取附件信息 var fullHtml = $('#idAttachmentsTable').html(); var fileName = new Array(); var i = 0; $("#idAttachmentsTable").find('a').each(function() {   fileName[i] = new Array();   fileName[i][0]= $(this).text();   fileName[i][1] = $(this).attr('href');   i++; });
//排序 fileName.sort();
//清空现有附件信息 document.getElementById(
'divIdAttachmentsTable').innerHTML = '';
//设置排序
for(var cntArr=0; cntArr<fileName.length;cntArr++) {   var strHref = "<a href='"+fileName[cntArr][1]+"'>"+fileName[cntArr][0]+"</a><br/>";   document.getElementById('divIdAttachmentsTable').innerHTML += strHref; }
</script>

 

你可能感兴趣的:(SharePoint)