From 39ce07df7b3f8c485584dfde7c0eea15aeaad9f7 Mon Sep 17 00:00:00 2001
From: Hadi Amiri <84700249+hdamr@users.noreply.github.com>
Date: Tue, 21 Dec 2021 10:12:02 +0200
Subject: [PATCH] fix: handle showing hidden column while clearing grid filter
(#2200)
---
src/vaadin-grid-column.html | 10 ++++++++-
test/filtering.html | 43 +++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/src/vaadin-grid-column.html b/src/vaadin-grid-column.html
index 759a9c597..00351ec7a 100644
--- a/src/vaadin-grid-column.html
+++ b/src/vaadin-grid-column.html
@@ -322,7 +322,15 @@
}
cells.forEach(cell => {
- const model = this._grid.__getRowModel(cell.parentElement);
+ const parent = cell.parentElement;
+
+ // When a column is made hidden and shown again, in some instances it breaks rendering of rows for grid
+ // this happens when parent element of cell is null, which might not be set correctly during rendering
+ // the newly shown column, this check simply avoid that case
+ if (!parent) {
+ return;
+ }
+ const model = this._grid.__getRowModel(parent);
if (renderer) {
cell._renderer = renderer;
diff --git a/test/filtering.html b/test/filtering.html
index 39ddcdec4..2d831c157 100644
--- a/test/filtering.html
+++ b/test/filtering.html
@@ -70,6 +70,15 @@
+
+
+
+
+
+
+
+
+