Active test on Grid's ColumnMenuFilter stops working with more than two items checked

1 Answer 51 Views
Filter  Grid
Brad
Top achievements
Rank 1
Brad asked on 24 Oct 2022, 03:14 PM

I'm trying to let the user see which columns in a Grid have an active filter or sort.  I'm using some examples I've seen in the components / forums, like this one to get started: https://www.telerik.com/forums/highlight-when-using-a-filter-in-the-grid.

Generally, it works.  If a user sets a filter on column X, the grid shows a different background color.  The problem happens when there is a GridColumnMenuCheckboxFilter, and the user selects more than two items.  The filter applies correctly, but it does not show the user that it's filtered.  The GridColumnMenuFilter.active function returns false.

Here's an example: 

https://stackblitz.com/edit/react-skkquv?file=app%2Fmain.tsx

Thank you,

Brad Larsen

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 26 Oct 2022, 05:46 AM

Hello Brad,

It seems that the "active" method of the GridColumnMenuFilter is designed to return true/false correctly for the standard filter only and it will indeed fail if there are more than two selected items. This is due to an internal check within the method (f.filters.length <= 2 &&).

I have modified the example with custom function that can be used for going through the filter descriptor to check if there are active filters for a field:

Hope this helps.

 

Regards,
Konstantin Dikov
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/.

Tags
Filter  Grid
Asked by
Brad
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or