gpt4 book ai didi

javascript - JQGrid 有两个垂直滚动条(左和右)

转载 作者:行者123 更新时间:2023-11-28 07:45:13 28 4
gpt4 key购买 nike

使用JQGrid 4.5.4

我需要在 JQGrid 的左侧和右侧都有垂直滚动条。

示例模型: Sample Dual Vertical Scrollbar

这可能吗?我进行了大量搜索,找到了两个水平滚动条的示例,但找不到 JQGrid 左右两侧都有两个垂直滚动条的示例。

最佳答案

我通过在 loadComplete 事件上添加一个小函数解决了这个问题。

此函数为左侧滚动条创建一个新的 div,然后同步两个滚动条。

                    loadComplete: function(){
var jqgridHeader = $(".ui-state-default.ui-jqgrid-hdiv");
// Add a new div with another div inside for the left scrollbar
jqgridHeader.after(
'<div id="leftScroll" style="z-index:1000; position:absolute; height:150px; overflow:scroll; width:17px;">'+
'<div id="leftScrollContent" style=" width:17px;"></div>' +
'</div>'
);
// Set to the new new div the sice of the jqgrid body
$("#leftScrollContent").css("height",($("#sortrows").height()));

var jqgridBody = $(".ui-jqgrid-bdiv");
// Syncronice both scrollbars
jqgridBody.scroll(function () {
$("#leftScroll").scrollTop(jqgridBody.scrollTop());
});
$("#leftScroll").scroll(function () {
jqgridBody.scrollTop($("#leftScroll").scrollTop());
});
}

*左侧滚动条与第一个网格列重叠

关于javascript - JQGrid 有两个垂直滚动条(左和右),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27512706/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com