Skip to content

Commit

Permalink
Fix #552: OnDemandList: Fix first row height calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth G. Franqueiro committed Sep 13, 2013
1 parent 8b4b929 commit 58fe9ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions OnDemandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,14 @@ return declare([List, _StoreMixin], {
// plugins that add connected elements to a row, like the tree

var sibling = rowElement.previousSibling;
return sibling && sibling.offsetTop != rowElement.offsetTop ?
rowElement.offsetHeight : 0;
sibling = sibling && !/\bdgrid-preload\b/.test(sibling.className) && sibling;

This comment has been minimized.

Copy link
@csnover

csnover Sep 19, 2013

Member

Can we be clear here?

if (sibling && /\bdgrid-preload\b/.test(sibling.className)) {
  sibling = null;
}

?

This comment has been minimized.

Copy link
@csnover

csnover Sep 19, 2013

Member

Actually…

if (sibling && !/\bdgrid-preload\b/.test(sibling.className)) {
  return rowElement.offsetTop - sibling.offsetTop;
}
else {
  return rowElement.offsetHeight;
}

// If a previous row exists, compare the top of this row with the
// previous one (in case "rows" are actually rendering side-by-side).
// If no previous row exists, this is either the first or only row,
// in which case we count its own height.
return sibling ? rowElement.offsetTop - sibling.offsetTop :
rowElement.offsetHeight;
},

lastScrollTop: 0,
Expand Down

0 comments on commit 58fe9ba

Please sign in to comment.