Declined
Last Updated: 28 Apr 2023 12:25 by ADMIN
Benjamin
Created on: 24 Apr 2023 10:00
Category: UI for Blazor
Type: Bug Report
0
Manually setting the grid filters via the grid state causes multiple composite filters on one column where only one filter descriptor for that member was set

Setting the FilterDirector directly:

Setting FilterDescriptor via SearchText:



Our search box is a custom TelerikTextbox not part of the grid, but essentially the same functionality as the built-in search box.

To test, use this code:
https://docs.telerik.com/blazor-ui/components/grid/filter/searchbox#customize-the-searchbox
But add it to FilterDescriptor immediately rather than setting SearchFilter like on the link.

 

This is the only instance of this on our site, and all of our grids use the exact same code via a generic method, on our object that controls the grid we have a custom empty attribute to dictate whether a column should be filterable via our textbox.

3 comments
ADMIN
Dimo
Posted on: 28 Apr 2023 12:25

Hello Benjamin,

OK, if you want to show the search string in the FilterMenu and this leads to repetitive textboxes, this means that the filter descriptor structure is wrong. For example, GridState.FilterDescriptors has a single parent descriptor, while it should have multiple ones - one for each filtered Field (Member). However, if you do this, the Grid will stop showing data, because the component applies all filter descriptors at root level with an AND logical operator, while you need OR.

So, my advice is to show the search string somewhere outside the FilterMenu and use the SearchFilter property of the Grid state.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Benjamin
Posted on: 28 Apr 2023 11:59

Hi Dimo,

That is exactly as I said.

We are making use of the Search Text now yes but we wanted to have it show up in the FilterMenu's text field which as we see is the FilterDecriptor, which caused a bug on the grid showing a bunch of duplicated filters.

Regards,

ADMIN
Dimo
Posted on: 28 Apr 2023 11:53

Hello Benjamin,

It looks like your app is adding FilterDescriptors to the Filter state. Instead, it should add descriptors to the Search state.

Note this code in our example. If you enable the FilterMenu for it, it will still work.

        GridState<SampleData> desiredState = new GridState<SampleData>()
        {
            SearchFilter = CreateSearchFilter()
        };

        await Grid.SetStateAsync(desiredState);

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!