Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Make sure children are requested for new expanded parents #2058

Merged
merged 4 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/vaadin-grid-data-provider-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@
.forEach(row => {
const cachedItem = this._cache.getItemForIndex(row.index);
if (cachedItem) {
this._toggleAttribute('loading', false, row);
this._updateItem(row, cachedItem);
this._getItem(row.index, row);
}
});

Expand Down
14 changes: 14 additions & 0 deletions test/data-provider.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,20 @@
expect(grid.dataProvider.getCall(0).args[0].parentItem).to.be.undefined;
});

it('should request items when scrolled to an expanded parent', done => {
grid.size = 51;
grid.dataProvider = sinon.spy(infiniteDataProvider);
grid.itemIdPath = 'value';
grid.expandedItems = [{value: 'foo50'}];
flushGrid(grid);
animationFrameFlush(() => {
grid.$.table.scrollTop = 10000;
flushGrid(grid);
expect(grid.dataProvider.lastCall.args[0].parentItem).to.be.ok;
done();
});
});

it('should request pages from 0', () => {
expect(grid.dataProvider.getCall(0).args[0].page).to.equal(0);
expect(grid.dataProvider.getCall(1).args[0].page).to.equal(1);
Expand Down