//var leftOffset;
//var checkHeaderLeft = setInterval(function () {
// var _grid = $('.ui-jqgrid');//grid div
// var dataTable = $(_grid[0]).find(".ui-jqgrid-bdiv"); //数据div
// var headerTable = $(_grid[0]).find(".ui-jqgrid-hbox"); //标题div
// leftOffset = - dataTable.scrollLeft() + 'px'; //获取数据div被拉动的距离
// $(headerTable[0]).find("table")[0].style.left = leftOffset; //移动标题行保持和数据行对应
// $($(headerTable[0]).find("table")[0]).css({"position":"relative"});
//},5);
//$(window).bind('scroll', function () {
// var _grid = $('.ui-jqgrid'); // grid div
// var dataTable = $(_grid[0]).find(".ui-jqgrid-bdiv");
// var headerTable = $(_grid[0]).find(".ui-jqgrid-hbox");
// var dataTableTop = dataTable.offset().top; //数据列到上部的距离
// var dataTableHeight = dataTableTop + dataTable.outerHeight();
// var windowTop = $(window).scrollTop();
// var headerTablePosition = headerTable[0].style.position;
// //Scroll down 94的上方导航栏的高度
// if (windowTop + 94 > dataTableTop - headerTable.height() && windowTop < (dataTableHeight - headerTable.height()) && headerTablePosition != "fixed") {
// var width = dataTable.width() + 'px';
// $(dataTable).css("top", (headerTable.height() + 1) + "px"); // +1 to account for the border width of the header
// headerTable[0].style.position = "fixed";
// headerTable[0].style.top = "94px";
// $(headerTable[0]).css({ "z-index": 10000, "width": width, "overflow": "hidden" }); //将标题栏固定住,超出部分隐藏
// $(".ui-corner-bottom").css({ "position": "relative", "top": "28px" });
// var gridHeightString = $('#outsourcing-list').css("height").replace("px", "");
// var newGridHeight = parseInt(gridHeightString) + headerTable.height() + 1; // +1 to account for the border width of the header
// $("#outsourcing-list").css("height", newGridHeight + "px"); //outermost grid element
// }
// //Scroll up
// else if (windowTop + 94 < (dataTableTop - headerTable.height()) && headerTablePosition == "fixed") {
// headerTable[0].style.position = "relative";
// headerTable[0].style.top = "0px";
// $(headerTable[0]).css({ "overflow": "initial" }); //还原标题栏之前的属性
// $(".ui-corner-bottom").css({ "position": "initial", "top": "0" });
// $($(headerTable[0]).find("table")[0]).css({ "position": "initial" });
// $(dataTable).css("top", "0px");
// $("#outsourcing-list").css("height", "100%"); //outermost grid element
// }
//});
网友评论