Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixed bug where ancestor-bindings were not removed #430

Merged
merged 2 commits into from

2 participants

@ClemensSchneider

In case the canvas-element is detached from the dom before the grid-instance is
destroyed, the unbinding from the canvas-elements' parents does not work reliably.

Clemens added some commits
Clemens fixed bug where ancestor-bindings were not removed in case the
canvas-element is detached from the dom before the grid-instance is
destroyed
895a91e
Clemens fixed formatting 36c65fa
@mleibman mleibman merged commit 3f1e052 into mleibman:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 28, 2012
  1. fixed bug where ancestor-bindings were not removed in case the

    Clemens authored
    canvas-element is detached from the dom before the grid-instance is
    destroyed
  2. fixed formatting

    Clemens authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +13 −2 slick.grid.js
View
15 slick.grid.js
@@ -122,6 +122,7 @@ if (typeof Slick === "undefined") {
var $viewport;
var $canvas;
var $style;
+ var $boundAncestors;
var stylesheet, columnCssRulesL, columnCssRulesR;
var viewportH, viewportW;
var canvasWidth;
@@ -434,13 +435,23 @@ if (typeof Slick === "undefined") {
while ((elem = elem.parentNode) != document.body && elem != null) {
// bind to scroll containers only
if (elem == $viewport[0] || elem.scrollWidth != elem.clientWidth || elem.scrollHeight != elem.clientHeight) {
- $(elem).bind("scroll.slickgrid", handleActiveCellPositionChange);
+ var $elem = $(elem);
+ if (!$boundAncestors) {
+ $boundAncestors = $elem;
+ } else {
+ $boundAncestors = $boundAncestors.add($elem);
+ }
+ $elem.bind("scroll." + uid, handleActiveCellPositionChange);
}
}
}
function unbindAncestorScrollEvents() {
- $canvas.parents().unbind("scroll.slickgrid");
+ if (!$boundAncestors) {
+ return;
+ }
+ $boundAncestors.unbind("scroll." + uid);
+ $boundAncestors = null;
}
function updateColumnHeader(columnId, title, toolTip) {
Something went wrong with that request. Please try again.