Declined
Last Updated: 04 Jul 2022 11:23 by ADMIN
Katja
Created on: 27 Jun 2022 13:07
Category: Grid
Type: Bug Report
1
Grid column filter 'delete' does not clear custom filter after filter is set programmatically

Hi,

When we use custom filters with FilterMenuTemplate in combination with setting filters programmatically, the filter value remains visible after using the 'delete' button.

Simplified example:

  1. First we load a filter programmatically by the button, this works fine:

  2. When user uses the Delete button, the grid state loses the FilterDescriptor and we get all the data as expected (also the filter icon loses the green color, as expected because no filter is active)

  3. When user reopens the filter menu, the value which was loaded programmatically is still present, without being used as a filter:

Note: We have the same issue with a custom filter with a checkbox list and that code is based on the example of the filter menu template in the documentation.

Note 2: When we use the custom filters and the 'Delete' button without setting the filters programmatically, everything works fine.

It's like the 'Delete' button clears the FilterDescriptors in de Grid State (and we get the data we expect), but the FilterDescriptors in the FilterMenuTemplateContext aren't cleared.. But only when those are set programmatically.. (by setting the grid state).

I already tried to think of a workaround by hooking the OnStateChanged, but there the FilterDescriptors on the grid state are empty when the 'Delete' button is used. As expected, because we get the data we want.. But don't think I can access the FilterMenuTemplateContext there, to clear it as well..

2 comments
ADMIN
Svetoslav Dimitrov
Posted on: 04 Jul 2022 11:23

Hello,

The FilterMenuTemplate is a RenderFragment. The RenderFragment can take any arbitrary HTML. In this case, this RenderFragment controls the rendering of the Filter Menu. In Blazor, we (as a component vendor) do not have a way to obtain the content of the RenderFragment on runtime. So to us, the content of the Filter Menu is unknown and thus we cannot reset the value of the TextBox or another component. 

Once the Allow control over the Filter and Close buttons of the FilterMenu feature request is available, you will be able to remove the value from the custom filtering components. I would advise you to click the Vote and Follow buttons to receive email notifications on status updates.

That being said, I am marking this Bug Report as Declined.

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tsaritsin
Posted on: 29 Jun 2022 20:11

the same problem

but we have button "Clear"

after click by "Clear" value "is true" still is visible, but filter apply correct

it is reproduce only for filter which is set in handler for OnStateInit

private Task HandleDeviceCategoryGridStateInitAsync(GridStateEventArgs<DeviceCategoryGrid> args)
{
     var state = new GridState<DeviceCategoryGrid>
     {
        FilterDescriptors = new FilterDescriptorCollection
            {
                new FilterDescriptor
                {
                    Member = nameof(DeviceCategoryGrid.IsActive),
                    Value = true
                }
            }
        };

        args.GridState = state;

        return Task.CompletedTask;
}