DataGrid column filter popup "breaks" after column visiblity change

I want to show only non-empty columns in RadzenDataGrid, and adjust column visibility in accordance with applied filter. I achieve that by setting column's Visible property. Everything works fine except when clearing the column filter after some columns were hidden. When I click on "Clear" button inside the column filter popup, the popup doesn't get hidden and becomes "broken". It can't be closed in any way. Please see provided code example and screen recording for additional details.

<RadzenDataGrid @ref="_grid" Data="Items" AllowFiltering="true">
		<RadzenDataGridColumn TItem="Item" Property="A" Title="A" Visible="@(IsColumnVisible("A"))" />
		<RadzenDataGridColumn TItem="Item" Property="B" Title="B" Visible="@(IsColumnVisible("B"))" />
		<RadzenDataGridColumn TItem="Item" Property="C" Title="C" Visible="@(IsColumnVisible("C"))" />

@code {
	private RadzenDataGrid<Item> _grid;

	public IEnumerable<Item> Items { get; set; } = new List<Item>
		new Item { A = "A1", B = "", C = "C1" },
		new Item { A = "A2", B = "B2", C = "C2" },

	bool IsColumnVisible(string propertyName)
		return !_grid.View.All(item => string.IsNullOrEmpty(item[propertyName]));

	public class Item
		public string A { get; set; }

		public string B { get; set; }

		public string C { get; set; }

		public string this[string propertyName]
				switch (propertyName)
					case "A":
						return A;
					case "B":
						return B;
					case "C":
						return C;
						throw new ArgumentOutOfRangeException();


Changing column visibility with expression on every state change might lead to unpredictable problems.

Filter popup gets broken even if I manually change column visibility, without using expressions. Please see attached screen recording of Blazor DataGrid column picker demo with filtering enabled:

I was able to fix this issue and the fix will be part of our next update.

1 Like