有没有可能';冻结窗格';在SharePoint列表中?
我需要保留我的列标题,这样人们可以看到那里显示了什么数据,但我找不到这是否可行,或者如何做到这一点。在列表中添加一个导航栏也很好。有什么建议吗有没有可能';冻结窗格';在SharePoint列表中?,sharepoint,list,listview,Sharepoint,List,Listview,我需要保留我的列标题,这样人们可以看到那里显示了什么数据,但我找不到这是否可行,或者如何做到这一点。在列表中添加一个导航栏也很好。有什么建议吗 谢谢,查看这篇文章:。我最近遇到了类似的挑战,并编写了以下代码。该代码适用于IE,但在Chrome中,浏览器的宽度存在问题 不管怎样,希望能有帮助 <script type="text/javascript"> $(document).ready(function(){ // Replace 'NameOfList' with the n
谢谢,查看这篇文章:。我最近遇到了类似的挑战,并编写了以下代码。该代码适用于IE,但在Chrome中,浏览器的宽度存在问题 不管怎样,希望能有帮助
<script type="text/javascript">
$(document).ready(function(){
// Replace 'NameOfList' with the name of the SharePoint list
var $header = $("table[summary^='NameOfList']:first > tbody > tr.ms-viewheadertr");
var headertop = $header.offset().top;
// Replace 'NameOfColumn' with the name of the column that you would like to freeze
var $fzCol= $("tr.ms-viewheadertr th:contains('NameOfColumn')");
// IE has iFrame, Chrome doesn't have, so the 'n-th' count of the column is different in IE than in Chrome
if( $fzCol.siblings().eq(0).children().eq(0).prop("tagName") == "IFRAME"){ var shift = 0} else { var shift = 1};
var nfzCol=$fzCol.index()+shift;
var $mcol=$("table[summary^='NameOfList'] > tbody > tr:not(.ms-viewheadertr) > td:nth-child("+nfzCol+")");
var colleft=$mcol.eq(0).offset().left;
$(window).scroll(function(){
var windowtop = $('body').scrollTop();
if( windowtop > headertop ){
$header.css({"position":"absolute", "top":windowtop});
} else {
$header.css({"position":"static", "top":"0px"});
}
var windowleft = $('body').scrollLeft();
if (windowleft > colleft ){
$mcol.css({"position":"relative", "left": windowleft-colleft});
} else {
$mcol.css({"position":"static", "left":"0px"});
}
});
}
$(文档).ready(函数(){
//将“NameOfList”替换为SharePoint列表的名称
var$header=$(“表[summary^='NameOfList']:first>tbody>tr.ms-viewheadertr”);
var headertop=$header.offset().top;
//将“NameOfColumn”替换为要冻结的列的名称
var$fzCol=$(“tr.ms-viewheadertr th:contains('NameOfColumn'));
//IE有iFrame,Chrome没有,所以IE中列的第n个计数与Chrome中的不同
if($fzCol.sides().eq(0).children().eq(0).prop(“标记名”)==“IFRAME”){var shift=0}否则{var shift=1};
var nfzCol=$fzCol.index()+shift;
var$mcol=$(“表[summary^='NameOfList']>tbody>tr:not(.ms viewheadertr)>td:n子项(“+nfzCol+”);
var colleft=$mcol.eq(0).offset().左;
$(窗口)。滚动(函数(){
var windowtop=$('body')。scrollTop();
如果(窗口顶部>标题顶部){
$header.css({“position”:“absolute”,“top”:windowtop});
}否则{
$header.css({“position”:“static”,“top”:“0px”});
}
var windowleft=$('body')。scrollLeft();
如果(窗口左>收集){
$mcol.css({“位置”:“相对”,“左”:windowleft colleft});
}否则{
$mcol.css({“position”:“static”,“left”:“0px”});
}
});
}
请更改链接,因为它不受信任。