From 91d04c64771832a0b8815ffbe1f0f9920320d94d Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 14 Feb 2017 19:41:00 -0500 Subject: Initial OpenECOMP policy/engine commit Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e Signed-off-by: Pamela Dragosh --- .../fusion/raptor/js/persist_table_header.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ecomp-sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js (limited to 'ecomp-sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js') diff --git a/ecomp-sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js b/ecomp-sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js new file mode 100644 index 000000000..2c90306f0 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js @@ -0,0 +1,47 @@ + function UpdateTableHeaders() { + $("div.divTableWithFloatingHeader").each(function() { + var originalHeaderRow = $(".tableFloatingHeaderOriginal", this); + var floatingHeaderRow = $(".tableFloatingHeader", this); + var offset = $(this).offset(); + var scrollTop = $(window).scrollTop(); + if ((scrollTop > offset.top) && (scrollTop < offset.top + $(this).height())) { + floatingHeaderRow.css("visibility", "visible"); + floatingHeaderRow.css("top", Math.min(scrollTop - offset.top, $(this).height() - floatingHeaderRow.height()) + "px"); + floatingHeaderRow.css("z-index", "20"); + + // 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.tableWithFloatingHeader").each(function() { + $(this).wrap("
"); + + 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); + }); \ No newline at end of file -- cgit 1.2.3-korg