Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use a flag for between row elements, and iterate past them before and…

… after checking valid rows.

When removing nodes, always incrementally adjust the preload height
Adjust count properly when scrolling progressively up
  • Loading branch information...
commit 932b97e52e201b402f6801ccc7551525701d9114 1 parent a15ba79
@kriszyp authored
Showing with 12 additions and 7 deletions.
  1. +10 −6 OnDemandList.js
  2. +2 −1  tree.js
View
16 OnDemandList.js
@@ -211,12 +211,17 @@ return declare([List, _StoreMixin], {
var toDelete = [];
while((row = nextRow)){
var rowHeight = grid._calcRowHeight(row);
- if(reclaimedHeight + rowHeight + farOffRemoval > distanceOff || (nextRow.className.indexOf("dgrid-row") < 0 && nextRow.className.indexOf("dgrid-loading") < 0)){
+ if(row.betweenRow){
+ // skip in between rows
+ row = row[traversal];
+ }
+ if(!row || reclaimedHeight + rowHeight + farOffRemoval > distanceOff || (row.className.indexOf("dgrid-row") < 0 && row.className.indexOf("dgrid-loading") < 0)){
// we have reclaimed enough rows or we have gone beyond grid rows, let's call it good
break;
}
var nextRow = row[traversal]; // have to do this before removing it
- if(nextRow.className.indexOf("dgrid-between-row") > -1){
+ if(nextRow && nextRow.betweenRow){
+ // skip in between rows
nextRow = nextRow[traversal];
}
var lastObserverIndex, currentObserverIndex = row.observerIndex;
@@ -243,11 +248,9 @@ return declare([List, _StoreMixin], {
preload.count += count;
if(below){
preloadNode.rowIndex -= count;
- adjustHeight(preload);
- }else{
- // if it is above, we can calculate the change in exact row changes, which we must do to not mess with the scrolling
- preloadNode.style.height = (preloadNode.offsetHeight + reclaimedHeight) + "px";
}
+ // calculate the change in exact row changes, which we must do to not mess with the scrolling
+ preloadNode.style.height = (preloadNode.offsetHeight + reclaimedHeight) + "px";
// we remove the elements after expanding the preload node so that the contraction doesn't alter the scroll position
if(toDelete.length){
var trashBin = put("div");
@@ -357,6 +360,7 @@ return declare([List, _StoreMixin], {
queryRowsOverlap = 0;
}else{
keepScrollTo = true;
+ count = priorCount - offset;
}
}
options.start = preload.count = offset;
View
3  tree.js
@@ -163,7 +163,8 @@ return function(column){
if(!target.preloadNode){
// if the children have not been created, create a container, a preload node and do the
// query for the children
- container = rowElement.connected = put('div.dgrid-tree-container.dgrid-between-row');//put(rowElement, '+...
+ container = rowElement.connected = put('div.dgrid-tree-container');//put(rowElement, '+...
+ container.betweenRow = true;
if(preloadNode){
put(rowElement, '+', container, preloadNode);
}else{
Please sign in to comment.
Something went wrong with that request. Please try again.