Skip to content

Commit

Permalink
fix: make sure rows are generated to an empty grid with heightByRows (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed May 14, 2021
1 parent d2bb60a commit d654f77
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/vaadin-grid/src/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ registerStyles(
position: relative;
}
:host([height-by-rows]) #items:empty {
height: 1px;
}
#table {
display: flex;
flex-direction: column;
Expand Down
4 changes: 2 additions & 2 deletions packages/vaadin-grid/src/vaadin-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,8 @@ class GridElement extends ElementMixin(
}

/** @protected */
__updateVisibleRows() {
this.__virtualizer && this.__virtualizer.update();
__updateVisibleRows(start, end) {
this.__virtualizer && this.__virtualizer.update(start, end);
}

/**
Expand Down
15 changes: 14 additions & 1 deletion packages/vaadin-grid/test/resizing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
getRowCells,
infiniteDataProvider,
scrollToEnd,
nextResize
nextResize,
getPhysicalItems
} from './helpers.js';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
Expand Down Expand Up @@ -107,6 +108,18 @@ describe('resizing', () => {
expect(grid.clientHeight).to.equal(headerHeight + bodyHeight + footerHeight);
});

it('should have body rows if header is not visible', async () => {
grid = fixtureSync(`
<vaadin-grid>
<vaadin-grid-column path="value"></vaadin-grid-column>
</vaadin-grid>`);
grid.firstElementChild.header = null;
grid.heightByRows = true;
grid.items = [{ value: 1 }];
flushGrid(grid);
expect(getPhysicalItems(grid).length).to.be.above(0);
});

// NOTE: This issue only manifests with scrollbars that affect the layout
// (On mac: Show scroll bars: Always) and Chrome / Safari browser
it('should have correct layout after column width change', async () => {
Expand Down

0 comments on commit d654f77

Please sign in to comment.