Skip to content

Commit

Permalink
FF/IE row flow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Jan 17, 2016
1 parent 63e646f commit 3602d62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LightPivotTable",
"author": "ZitRo",
"version": "1.5.2",
"version": "1.5.3",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
Expand Down
20 changes: 18 additions & 2 deletions source/js/PivotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ PivotView.prototype.recalculateSizes = function (container) {

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

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

/**
* #keepSizes
* This fixes FF/IE strange issue that assigns, for example, "12.05" instead of "12" to
* the cell height and, as a result, row headers and rows are inconsistent.
* @type {Array}
*/
var keepSizes = [].slice.call(leftHeader.getElementsByTagName("th")).map(function (e) {
return {
el: e.getElementsByTagName("div")[0],
height: e.getElementsByTagName("div")[0].offsetHeight
};
});

container.parentNode.removeChild(container); // detach

topHeader.style.marginLeft = headerW + "px";
Expand Down Expand Up @@ -895,11 +907,15 @@ PivotView.prototype.recalculateSizes = function (container) {
if (pTableHead.childNodes[i].firstChild) {
pTableHead.childNodes[i].firstChild.style.height =
(columnHeights[i] || columnHeights[i - 1] || DEFAULT_CELL_HEIGHT)
+ IE_EXTRA_SIZE
+ "px";
}
}

// #keepSizes
keepSizes.forEach(function (o) {
o.el.style.height = parseInt(o.height) + "px";
});

containerParent.appendChild(container); // attach

/*
Expand Down

0 comments on commit 3602d62

Please sign in to comment.