Skip to content

Commit bc822be

Browse files
lpt sizes fix (experimental) + IE origin fix
1 parent f7feb7d commit bc822be

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

export/LightPivotTable-DeepSeePortlet.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<Class name="DeepSee.LightPivotTable">
1313
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
14-
<TimeChanged>63572,80952.436177</TimeChanged>
14+
<TimeChanged>63574,73711.132259</TimeChanged>
1515
<TimeCreated>63515,61322.546099</TimeCreated>
1616

1717
<Parameter name="INCLUDEFILES">
@@ -248,6 +248,11 @@
248248
// filtering frequent size updates as an expensive operation
249249
this._SIZE_ADJUST_TIMEOUT = 0;
250250
this._FIRST_TIME_SIZE_UPDATE = true;
251+
252+
// fix location.origin for IE
253+
if (!window.location.origin) {
254+
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
255+
}
251256
]]></Implementation>
252257
</Method>
253258

source/css/LightPivot.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
}
8888

8989
.lpt th, .lpt td {
90-
white-space: nowrap;
90+
white-space: pre;
9191
box-sizing: border-box;
9292
}
9393

source/js/PivotView.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,22 @@ PivotView.prototype.recalculateSizes = function (container) {
475475
headerW = leftHeader.offsetWidth,
476476
headerH = topHeader.offsetHeight,
477477
containerHeight = container.offsetHeight,
478+
bodyHeight = containerHeight - headerH - pagedHeight,
478479
mainHeaderWidth = headerContainer.offsetWidth,
479-
addExtraLeftHeaderCell = lTableHead.offsetHeight
480-
> containerHeight - headerH - pagedHeight && this.SCROLLBAR_WIDTH > 0,
481-
cell, tr, cellWidths = [], columnHeights = [], i, hasVerticalScrollBar;
480+
hasVerticalScrollBar = lTableHead.offsetHeight > bodyHeight
481+
&& this.SCROLLBAR_WIDTH > 0,
482+
cell, tr, cellWidths = [], columnHeights = [], i;
482483

483484
headerContainer.style.width = headerW + "px";
485+
if (hasVerticalScrollBar && tTableHead.childNodes[0]) {
486+
tr = document.createElement("th");
487+
tr.style.minWidth = this.SCROLLBAR_WIDTH + "px";
488+
tr.style.width = this.SCROLLBAR_WIDTH + "px";
489+
tr.rowSpan = tTableHead.childNodes.length;
490+
tr["_extraCell"] = true;
491+
tTableHead.childNodes[0].appendChild(tr);
492+
}
493+
484494
if (container["_primaryColumns"]) {
485495
for (i in container["_primaryColumns"]) {
486496
cellWidths.push(container["_primaryColumns"][i].offsetWidth);
@@ -506,7 +516,14 @@ PivotView.prototype.recalculateSizes = function (container) {
506516
tableBlock.style.height = containerHeight - headerH - pagedHeight + "px";
507517
headerContainer.style.height = headerH + "px";
508518

509-
if (addExtraLeftHeaderCell) {
519+
for (i in container["_primaryRows"]) {
520+
container["_primaryRows"][i].style.height = columnHeights[i] + "px";
521+
}
522+
for (i in container["_primaryColumns"]) {
523+
container["_primaryColumns"][i].style.width = cellWidths[i] + "px";
524+
}
525+
526+
if (hasVerticalScrollBar) { // horScroll?
510527
tr = document.createElement("tr");
511528
tr.appendChild(cell = document.createElement("th"));
512529
lTableHead.appendChild(tr);
@@ -537,17 +554,6 @@ PivotView.prototype.recalculateSizes = function (container) {
537554

538555
containerParent.appendChild(container); // attach
539556

540-
hasVerticalScrollBar = Math.max(lTableHead.offsetHeight, pTableHead.offsetHeight)
541-
> containerHeight - headerH - pagedHeight;
542-
if (hasVerticalScrollBar && tTableHead.childNodes[0]) {
543-
tr = document.createElement("th");
544-
tr.style.minWidth = this.SCROLLBAR_WIDTH + "px";
545-
tr.style.width = this.SCROLLBAR_WIDTH + "px";
546-
tr.rowSpan = tTableHead.childNodes.length;
547-
tr["_extraCell"] = true;
548-
tTableHead.childNodes[0].appendChild(tr);
549-
}
550-
551557
} catch (e) {
552558
console.error("Error when fixing sizes.", "ERROR:", e);
553559
}
@@ -651,7 +657,7 @@ PivotView.prototype.renderRawData = function (data) {
651657
if (!rendered || separatelyGrouped) { // create element
652658
if (!tr) tr = document.createElement("tr");
653659
tr.appendChild(th = document.createElement("th"));
654-
th.textContent = rawData[y][x].value;
660+
th.textContent = rawData[y][x].value || " ";
655661
if (rawData[y][x].style) th.setAttribute("style", rawData[y][x].style);
656662
if (rawData[y][x].className) th.className = rawData[y][x].className;
657663
if (rawData[y][x].group) renderedGroups[rawData[y][x].group] = {

0 commit comments

Comments
 (0)