Skip to content

Commit

Permalink
fix rowHeight value to reflect average row height (#1423)
Browse files Browse the repository at this point in the history
rowHeight is currently not getting set to a value but it used to
influence the average row height calculations. This change updates the
rowHeight property to be the value latest preload rowHeight
  • Loading branch information
nicknisi authored and edhager committed Jun 3, 2019
1 parent 9ae3dcf commit a8846ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OnDemandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ define([

_updatePreloadRowHeights: function () {
var preload = this.preload;
var rowHeight = 0;
if (!preload) {
return;
}
Expand All @@ -392,12 +393,14 @@ define([
}
while (preload) {
if (!preload.rowHeight) {
preload.rowHeight = this.rowHeight ||
preload.rowHeight =
this._calcAverageRowHeight(preload.node.parentNode.querySelectorAll('.dgrid-row'));
this._adjustPreloadHeight(preload);
}
rowHeight = preload ? preload.rowHeight : rowHeight;
preload = preload.next;
}
this.rowHeight = rowHeight;
},

lastScrollTop: 0,
Expand Down
1 change: 1 addition & 0 deletions test/intern/core/OnDemandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ define([

test.test('calculated row height', function () {
assert.strictEqual(16, list.preload.rowHeight);
assert.strictEqual(16, list.rowHeight);
});
});
});

0 comments on commit a8846ca

Please sign in to comment.