Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toggling frozen rows should recalc scroll height, closes #737 #774

Merged
merged 1 commit into from
May 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ if (typeof Slick === "undefined") {
var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' };
var _hiddenParents;
var oldProps = [];
var enforceFrozenRowHeightRecalc = false;
var columnResizeDragging = false;
var slickDraggableInstance = null;
var slickMouseWheelInstances = [];
Expand Down Expand Up @@ -3221,6 +3222,11 @@ if (typeof Slick === "undefined") {
validateAndEnforceOptions();
setFrozenOptions();

// when user changed frozen row option, we need to force a recalculation of each viewport heights
if (args.frozenBottom !== undefined) {
enforceFrozenRowHeightRecalc = true;
}

_viewport.forEach(function (view) {
view.style["overflow-y"] = options.autoHeight ? "hidden" : "auto";
});
Expand Down Expand Up @@ -3970,7 +3976,7 @@ if (typeof Slick === "undefined") {
}
}

if (h !== oldH) {
if (h !== oldH || enforceFrozenRowHeightRecalc) {
if (hasFrozenRows && !options.frozenBottom) {
utils.height(_canvasBottomL, h);

Expand All @@ -3983,6 +3989,7 @@ if (typeof Slick === "undefined") {
}

scrollTop = _viewportScrollContainerY.scrollTop;
enforceFrozenRowHeightRecalc = false; // reset enforce flag
}

var oldScrollTopInRange = (scrollTop + offset <= th - tempViewportH);
Expand Down