Skip to content

Commit

Permalink
fix(core): rollback PR #497 which is now causing resize issue (#503)
Browse files Browse the repository at this point in the history
- the PR #497 was wrong and should be rolled back since the pre-header height is already calculated by getViewportHeight() which is called in the resizeCanvas() method.
  • Loading branch information
ghiscoding authored May 21, 2020
1 parent 4d6b929 commit af948b1
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,7 @@ if (typeof Slick === "undefined") {

(function ($) {
"use strict";

// Slick.Grid
$.extend(true, window, {
Slick: {
Expand Down Expand Up @@ -584,7 584,7 @@ if (typeof Slick === "undefined") {
$footerRow
.on("contextmenu", handleFooterContextMenu)
.on("click", handleFooterClick);

$footerRowScroller
.on("scroll", handleFooterRowScroll);
}
Expand Down Expand Up @@ -1280,7 1280,7 @@ if (typeof Slick === "undefined") {
}
}
}

if (m.sortable) {
header.addClass("slick-header-sortable");
header.append("<span class='slick-sort-indicator"
Expand Down Expand Up @@ -2095,21 2095,21 @@ if (typeof Slick === "undefined") {
var c = columnOrIndexOrId;
if (typeof columnOrIndexOrId === 'number') {
c = columns[columnOrIndexOrId];
}
}
else if (typeof columnOrIndexOrId === 'string') {
for (i = 0; i < columns.length; i ) {
if (columns[i].Id === columnOrIndexOrId) { c = columns[i]; }
}
}
var $gridCanvas = $(getCanvasNode(0, 0));
getColAutosizeWidth(c, $gridCanvas, isInit);
getColAutosizeWidth(c, $gridCanvas, isInit);
}

function autosizeColumns(autosizeMode, isInit) {
//LogColWidths();

autosizeMode = autosizeMode || options.autosizeColsMode;
if (autosizeMode === Slick.GridAutosizeColsMode.LegacyForceFit
if (autosizeMode === Slick.GridAutosizeColsMode.LegacyForceFit
|| autosizeMode === Slick.GridAutosizeColsMode.LegacyOff) {
legacyAutosizeColumns();
return;
Expand Down Expand Up @@ -2172,7 2172,7 @@ if (typeof Slick === "undefined") {
colWidth = c.autoSize.widthPx;
}
if (c.rerenderOnResize && c.width != colWidth) { reRender = true; }
c.width = colWidth;
c.width = colWidth;
}
} else if ((options.viewportSwitchToScrollModeWidthPercent && totalWidthLessSTR strColsMinWidth > viewportWidth * options.viewportSwitchToScrollModeWidthPercent / 100)
|| (totalMinWidth > viewportWidth)) {
Expand Down Expand Up @@ -2200,19 2200,19 @@ if (typeof Slick === "undefined") {
}
}
if (c.rerenderOnResize && c.width != colWidth) { reRender = true; }
c.width = colWidth;
c.width = colWidth;
}
}
}

if (autosizeMode === Slick.GridAutosizeColsMode.IgnoreViewport) {
// just size columns as-is
for (i = 0; i < columns.length; i ) {
for (i = 0; i < columns.length; i ) {
colWidth = columns[i].autoSize.widthPx;
if (columns[i].rerenderOnResize && columns[i].width != colWidth) {
reRender = true;
}
columns[i].width = colWidth;
columns[i].width = colWidth;
}
}

Expand Down Expand Up @@ -2529,7 2529,7 @@ if (typeof Slick === "undefined") {
}
columns[i].width = widths[i];
}

reRenderColumns(reRender);
}

Expand Down Expand Up @@ -2740,7 2740,7 @@ if (typeof Slick === "undefined") {

var m = columns[i] = $.extend({}, columnDefaults, columns[i]);
m.autoSize = $.extend({}, columnAutosizeDefaults, m.autoSize);

columnsById[m.id] = i;
if (m.minWidth && m.width < m.minWidth) {
m.width = m.minWidth;
Expand Down Expand Up @@ -3452,7 3452,6 @@ if (typeof Slick === "undefined") {
paneBottomH = 0;
viewportTopH = 0;
viewportBottomH = 0;
var preHeaderHeight = options.showPreHeaderPanel ? options.preHeaderPanelHeight : 0;

getViewportWidth();
getViewportHeight();
Expand All @@ -3471,7 3470,7 @@ if (typeof Slick === "undefined") {
}

// The top pane includes the top panel and the header row
paneTopH = topPanelH preHeaderHeight headerRowH footerRowH;
paneTopH = topPanelH headerRowH footerRowH;

if (hasFrozenColumns() && options.autoHeight) {
paneTopH = scrollbarDimensions.height;
Expand Down Expand Up @@ -4622,7 4621,7 @@ if (typeof Slick === "undefined") {
var column = $footer && $footer.data("column");
trigger(self.onFooterClick, {column: column}, e);
}

function handleMouseEnter(e) {
trigger(self.onMouseEnter, {}, e);
}
Expand Down

0 comments on commit af948b1

Please sign in to comment.