Created
June 27, 2013 23:39
-
-
Save mhils/5881334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/List.js b/List.js | |
index f67f08f..84f2a0a 100644 | |
--- a/List.js | |
+++ b/List.js | |
@@ -467,6 +467,7 @@ function(kernel, declare, listen, has, miscUtil, TouchScroll, hasClass, put){ | |
from != to && firstRow && self.adjustRowIndices(firstRow); | |
self._onNotification(rows, object, from, to); | |
}, true)) - 1; | |
+ beforeNode.observerIndex = observerIndex; | |
} | |
var rowsFragment = document.createDocumentFragment(); | |
// now render the results | |
diff --git a/OnDemandList.js b/OnDemandList.js | |
index 96041e8..38b3e15 100644 | |
--- a/OnDemandList.js | |
+++ b/OnDemandList.js | |
@@ -336,17 +336,17 @@ return declare([List, _StoreMixin], { | |
break; | |
} | |
var nextRow = row[traversal]; // have to do this before removing it | |
- var lastObserverIndex, currentObserverIndex = row.observerIndex; | |
- if(currentObserverIndex != lastObserverIndex && lastObserverIndex > -1){ | |
+ var currentObserverIndex = row.observerIndex, | |
+ nextObserverIndex = nextRow ? nextRow.observerIndex : -1; | |
+ if(currentObserverIndex != nextObserverIndex){ | |
// we have gathered a whole page of observed rows, we can delete them now | |
var observers = grid.observers; | |
- var observer = observers[lastObserverIndex]; | |
+ var observer = observers[currentObserverIndex]; | |
observer && observer.cancel(); | |
- observers[lastObserverIndex] = 0; // remove it so we don't call cancel twice | |
+ observers[currentObserverIndex] = 0; // remove it so we don't call cancel twice | |
} | |
reclaimedHeight += rowHeight; | |
count += row.count || 1; | |
- lastObserverIndex = currentObserverIndex; | |
// we just do cleanup here, as we will do a more efficient node destruction in the setTimeout below | |
grid.removeRow(row, true); | |
toDelete.push(row); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment