FSN#34665 Kolomkoppen worden vastgehouden, opmaak moet nog
svn path=/Website/trunk/; revision=30987
This commit is contained in:
49
APPL/Localscripts/floatThead.js
Normal file
49
APPL/Localscripts/floatThead.js
Normal file
@@ -0,0 +1,49 @@
|
||||
function UpdateTableHeaders() {
|
||||
$("div.divrstable").each(function() {
|
||||
var originalHeaderRow = $(".tableFloatingHeaderOriginal", this);
|
||||
var floatingHeaderRow = $(".tableFloatingHeader", this);
|
||||
var firstFrame = $(this).offset();
|
||||
var secondFrame = $(window.frameElement).offset();
|
||||
var scrollTop = $(window.parent).scrollTop();
|
||||
offset = firstFrame.top + secondFrame.top;
|
||||
if ((scrollTop > offset) && (scrollTop < offset + $(this).height())) {
|
||||
floatingHeaderRow.css("visibility", "visible");
|
||||
floatingHeaderRow.css("top", Math.min(scrollTop - offset, $(this).height() - floatingHeaderRow.height()) + "px");
|
||||
|
||||
// Copy cell widths from original header
|
||||
$("th", floatingHeaderRow).each(function(index) {
|
||||
var cellWidth = $("th", originalHeaderRow).eq(index).css('width');
|
||||
$(this).css('width', cellWidth);
|
||||
});
|
||||
|
||||
// Copy row width from whole table
|
||||
floatingHeaderRow.css("width", $(this).css("width"));
|
||||
}
|
||||
else {
|
||||
floatingHeaderRow.css("visibility", "hidden");
|
||||
floatingHeaderRow.css("top", "0px");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("table").each(function() {
|
||||
$(this).wrap("<div class=\"divrstable\" style=\"position:relative\"></div>");
|
||||
|
||||
var originalHeaderRow = $("tr:first", this)
|
||||
originalHeaderRow.before(originalHeaderRow.clone());
|
||||
var clonedHeaderRow = $("tr:first", this)
|
||||
|
||||
clonedHeaderRow.addClass("tableFloatingHeader");
|
||||
clonedHeaderRow.css("position", "absolute");
|
||||
clonedHeaderRow.css("top", "0px");
|
||||
clonedHeaderRow.css("left", $(this).css("margin-left"));
|
||||
clonedHeaderRow.css("visibility", "hidden");
|
||||
|
||||
originalHeaderRow.addClass("tableFloatingHeaderOriginal");
|
||||
});
|
||||
UpdateTableHeaders();
|
||||
$(window.parent).scroll(UpdateTableHeaders);
|
||||
$(window.parent).resize(UpdateTableHeaders);
|
||||
});
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<%
|
||||
FCLTHeader.Requires({ plugins: ["jQuery"],
|
||||
js: ["resultset_table_v2.js", "sorttable.js"]
|
||||
js: ["resultset_table_v2.js", "sorttable.js", "floatThead.js"]
|
||||
});
|
||||
|
||||
var APIname = getQParam("API","");
|
||||
|
||||
Reference in New Issue
Block a user