Skip to content

Commit 6694fa8

Browse files
christophe-gtomivirkki
authored andcommitted
fix: details broken when hidden (#1754)
1 parent 8cbae17 commit 6694fa8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/vaadin-grid.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610
}
611611
columns
612612
.filter(column => !column.hidden)
613-
.forEach((column, index) => {
613+
.forEach((column, index, cols) => {
614614
let cell;
615615

616616
if (section === 'body') {
@@ -624,7 +624,7 @@
624624
cell.setAttribute('part', 'cell body-cell');
625625
row.appendChild(cell);
626626

627-
if (index === columns.length - 1 && (this._rowDetailsTemplate || this.rowDetailsRenderer)) {
627+
if (index === cols.length - 1 && (this._rowDetailsTemplate || this.rowDetailsRenderer)) {
628628
// Add details cell as last cell to body rows
629629
this._detailsCells = this._detailsCells || [];
630630
const detailsCell = this._detailsCells.filter(cell => cell._vacant)[0] || this._createCell('td');

test/column.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@
198198
flushGrid(grid);
199199
expect(() => grid.render()).not.to.throw(Error);
200200
});
201+
202+
it('should not remove details row when a column is hidden', () => {
203+
grid.rowDetailsRenderer = root => root.textContent = 'row-details';
204+
grid.detailsOpenedItems = [grid._cache.items[0]];
205+
column.hidden = true;
206+
flushGrid(grid);
207+
const details = grid.shadowRoot.querySelector('#items [part~="details-cell"]')._content;
208+
expect(details.textContent).to.equal('row-details');
209+
});
201210
});
202211

203212
describe('path', () => {

0 commit comments

Comments
 (0)