Skip to content

Commit 3602d62

Browse files
FF/IE row flow fix
1 parent 63e646f commit 3602d62

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "LightPivotTable",
33
"author": "ZitRo",
4-
"version": "1.5.2",
4+
"version": "1.5.3",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
77
"repository": {

source/js/PivotView.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,6 @@ PivotView.prototype.recalculateSizes = function (container) {
745745

746746
var _ = this,
747747
CLICK_EVENT = this.controller.CONFIG["triggerEvent"] || "click",
748-
IE_EXTRA_SIZE = window.navigator.userAgent.indexOf("MSIE ") > -1 ? 1/3 : 0,
749748
header = container.getElementsByClassName("lpt-headerValue")[0];
750749

751750
if (!header) { return; } // pivot not ready - nothing to fix
@@ -835,6 +834,19 @@ PivotView.prototype.recalculateSizes = function (container) {
835834
console.warn("No _primaryRows property in container, cell sizes won't be fixed.");
836835
}
837836

837+
/**
838+
* #keepSizes
839+
* This fixes FF/IE strange issue that assigns, for example, "12.05" instead of "12" to
840+
* the cell height and, as a result, row headers and rows are inconsistent.
841+
* @type {Array}
842+
*/
843+
var keepSizes = [].slice.call(leftHeader.getElementsByTagName("th")).map(function (e) {
844+
return {
845+
el: e.getElementsByTagName("div")[0],
846+
height: e.getElementsByTagName("div")[0].offsetHeight
847+
};
848+
});
849+
838850
container.parentNode.removeChild(container); // detach
839851

840852
topHeader.style.marginLeft = headerW + "px";
@@ -895,11 +907,15 @@ PivotView.prototype.recalculateSizes = function (container) {
895907
if (pTableHead.childNodes[i].firstChild) {
896908
pTableHead.childNodes[i].firstChild.style.height =
897909
(columnHeights[i] || columnHeights[i - 1] || DEFAULT_CELL_HEIGHT)
898-
+ IE_EXTRA_SIZE
899910
+ "px";
900911
}
901912
}
902913

914+
// #keepSizes
915+
keepSizes.forEach(function (o) {
916+
o.el.style.height = parseInt(o.height) + "px";
917+
});
918+
903919
containerParent.appendChild(container); // attach
904920

905921
/*

0 commit comments

Comments
 (0)