Filter won’t close in DataGrid with multiple templated columns #500

Closed
opened 2026-01-29 17:38:18 +00:00 by claunia · 2 comments
Owner

Originally created by @CollinAlpert on GitHub (Aug 8, 2022).

Describe the bug
When adding at least two columns with a custom template in a data grid and then opening a filter, the filter will not close again. This does not happen when only one column exists in the data grid.

To Reproduce
I was able to reproduce this in a new Blazor WASM app:

<RadzenDataGrid AllowFiltering="true" Data="@_data" TItem="TestModel">
    <Columns>
        <RadzenDataGridColumn TItem="TestModel" Title="Key">
            <Template Context="model">
                <RadzenLink Path="@($"https://example.com/{model.Key}")" Text="@model.Key" target="_blank"/>
            </Template>
        </RadzenDataGridColumn>
        <RadzenDataGridColumn TItem="TestModel" Title="Value">
            <Template Context="model">
                <RadzenLink Path="@($"https://example.com/{model.Value}")" Text="@model.Value.ToString()" target="_blank"/>
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

and the code behind:

using Microsoft.AspNetCore.Components;
using Radzen.Blazor;

namespace WebAppTest.Pages;

public partial class TestView : ComponentBase
{
    private TestModel[] _data = new TestModel[]
    {
        new("Hello", 1),
        new("World", 2)
    };
}

public record TestModel(string Key, int Value);

Expected behavior
When clicking on the filter icon or anywhere else, the filter popup closes.

Instead, the border shadow changes, but the filter popup does not close. It is only possible to close the filter by opening and closing the filter of the other column.

Screenshots
After opening filter:
Screen Shot 2022-08-08 at 15 40 56

After closing filter:
Screen Shot 2022-08-08 at 15 41 12

The change in border shadow is faint, but noticeable.

Desktop

  • OS: macOS 12.5
  • Browser Firefox 103.0.1
  • Radzen version: 3.20.2
Originally created by @CollinAlpert on GitHub (Aug 8, 2022). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Professional or Еnterprise subscription you can report your issue or ask us a question via email at info@radzen.com. Radzen staff will reply within 24 hours (Professional) or 16 hours (Enterprise) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. Specify all the steps required to reproduce the issue or link a project which reproduces it easily (without requiring extra steps such as restoring a database). --> **Describe the bug** When adding at least two columns with a custom template in a data grid and then opening a filter, the filter will not close again. This does not happen when only one column exists in the data grid. **To Reproduce** I was able to reproduce this in a new Blazor WASM app: ```xaml <RadzenDataGrid AllowFiltering="true" Data="@_data" TItem="TestModel"> <Columns> <RadzenDataGridColumn TItem="TestModel" Title="Key"> <Template Context="model"> <RadzenLink Path="@($"https://example.com/{model.Key}")" Text="@model.Key" target="_blank"/> </Template> </RadzenDataGridColumn> <RadzenDataGridColumn TItem="TestModel" Title="Value"> <Template Context="model"> <RadzenLink Path="@($"https://example.com/{model.Value}")" Text="@model.Value.ToString()" target="_blank"/> </Template> </RadzenDataGridColumn> </Columns> </RadzenDataGrid> ``` and the code behind: ```csharp using Microsoft.AspNetCore.Components; using Radzen.Blazor; namespace WebAppTest.Pages; public partial class TestView : ComponentBase { private TestModel[] _data = new TestModel[] { new("Hello", 1), new("World", 2) }; } public record TestModel(string Key, int Value); ``` **Expected behavior** When clicking on the filter icon or anywhere else, the filter popup closes. Instead, the border shadow changes, but the filter popup does not close. It is only possible to close the filter by opening **and closing** the filter of the other column. **Screenshots** After opening filter: <img width="322" alt="Screen Shot 2022-08-08 at 15 40 56" src="https://user-images.githubusercontent.com/14217185/183431886-df55987a-eef4-4905-ac2c-b13c56985fb7.png"> After closing filter: <img width="337" alt="Screen Shot 2022-08-08 at 15 41 12" src="https://user-images.githubusercontent.com/14217185/183431998-2cae29ce-d32c-49e7-9dbf-c8e55aebe0b3.png"> The change in border shadow is faint, but noticeable. **Desktop** - OS: macOS 12.5 - Browser Firefox 103.0.1 - Radzen version: 3.20.2
Author
Owner

@enchev commented on GitHub (Aug 8, 2022):

I think it’s caused when Property is not specified - try to set it to Key/Value for the relevant column.

@enchev commented on GitHub (Aug 8, 2022): I think it’s caused when Property is not specified - try to set it to Key/Value for the relevant column.
Author
Owner

@CollinAlpert commented on GitHub (Aug 9, 2022):

Thanks, this solved the issue. It still seems like this is a bug. If you can give me some more information, I am happy to submit a PR.

@CollinAlpert commented on GitHub (Aug 9, 2022): Thanks, this solved the issue. It still seems like this is a bug. If you can give me some more information, I am happy to submit a PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#500