This is a migrated thread and some comments may be shown as answers.

How to make the filter case insensitive?

12 Answers 665 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Jorge
Top achievements
Rank 1
Jorge asked on 26 Sep 2018, 07:09 AM

Hi, 

I want that when I look for the filter be case insensitive but I can not find the way.
Thanks.

12 Answers, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 26 Sep 2018, 06:21 PM
Hello Jorge,

This isn't settable via the out-of-the-box filtering UI, however you can accomplish it with a custom FilterDescriptor.  

Here's an example:

<common:TextFilterDescriptor
    PropertyName="Country"
    Operator="StartsWith"
    IsCaseSensitive="False"
    Value="En"/>

For more information, see the Filtering documentation article as well as the Customize the Filtering UI article.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 30 Dec 2019, 04:05 PM

Hi Lance,

I am running into the issue with the filter being case sensitive, but your recommendation of making the property "IsCaseSensitive" to false is not working. I haven't found an issue case logged, and this comment was from over a year ago, so I am assuming no one else has ran into this issue, so I must be using it incorrectly.

Could you take a look and see what the issue might be?

<telerikDataGrid:RadDataGrid x:Name="InventoryDataGrid"
                                     ItemsSource="{ Binding Items }"
                                     AutoGenerateColumns="False"
                                     VerticalOptions="Start"
                                     Padding="5,0"
                                     UserEditMode="Cell"
                                     UserSortMode="Auto"
                                     UserFilterMode="Auto"
                                     Grid.Row="0"
                                     GridLinesColor="LightGray"
                                     GridLinesVisibility="Vertical"
                                     GridLinesThickness="1"
                                     Focused="OnEntryFocused">
            <telerikDataGrid:RadDataGrid.FilterDescriptors>
                <common:TextFilterDescriptor
                    PropertyName="Description"
                    Operator="Contains"
                    IsCaseSensitive="False"
                    Value="En"/>
            </telerikDataGrid:RadDataGrid.FilterDescriptors>
            <telerikDataGrid:RadDataGrid.GroupHeaderStyle>
                <telerikDataGrid:DataGridGroupHeaderStyle
                    TextMargin="5"           
                    TextColor="#0085CB"
                    BorderColor="LightGray"
                    BorderThickness="0,0,0,3"/>
            </telerikDataGrid:RadDataGrid.GroupHeaderStyle>
            <telerikDataGrid:RadDataGrid.AlternateRowBackgroundStyle>
                <telerikDataGrid:DataGridBorderStyle BackgroundColor="#E8E8E8"
                                                         BorderColor="LightGray"
                                                         BorderThickness="1"/>
            </telerikDataGrid:RadDataGrid.AlternateRowBackgroundStyle>
        </telerikDataGrid:RadDataGrid>

 

When I go into the datagrid and filter by the description column, the filter allows me to use a term that is within the description, but it is case sensitive.

Thanks

0
Lance | Senior Manager Technical Support
Telerik team
answered on 30 Dec 2019, 04:57 PM

Hi John,

I've tested your code and it is working as expected against sample data. Here is a screenshot:

Note: Observe the filter's Value is set to "En" and it successfully matches the lowercase "en".

Further Investigation

I would love to be able to take a closer look at your scenario as assist further. Please open a Support Ticket here (you have a priority support license) and attach a small test project with a few lines of your data so we can see the behavior.

We will see your ticket come in immediately. Either I, or one of my colleagues, will follow up with you in the ticket.

Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 30 Dec 2019, 05:57 PM

Thanks for the quick response Lance.

I think I might understand where I misunderstood the documentation. In your example, you are searching for a part of a term using just lowercase letters. I get the correct results if I were to do that. However, the issue I am having is if someone starts typing using all lowercase letters:

 

In your example, if I were to search "dive" the result "Divergent" would not show up. If I typed "Dive" it would. I just tested with my data, attached are the screenshots.

 

Unfiltered is my results with no filter.

 

farm_filtered is the results when doing a filter by "farm". Notice the results show all items with no description (another issue I need to look into).

 

arm_filtered is the results when doing a filter by "arm". Notice the results show all items with a description that includes "arm" including "Farms".

0
Lance | Senior Manager Technical Support
Telerik team
answered on 30 Dec 2019, 06:17 PM

Hi John,

I see you've replied to this public post instead of opening a ticket. I recommended opening a ticket so that you can get the best support your license provides. For your convenience, I have opened the ticket on your behalf and moved the details over.

We do our best to get to all forum posts, but this is affected by available resources and other priority tickets. It may take a few days to start investigating and answer a forum, while a priority support ticket guarantees a response within 24 hours.

Next Steps

So that the DataGrid team can give you the best support, please add a reply to that ticket with the code you're using to add and remove the filters as the user types into your custom filter box.

If you're not familiar with the support system, you can see you ticket list here: https://www.telerik.com/account/support-tickets/my-support-tickets

Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jeremy
Top achievements
Rank 1
answered on 17 Sep 2020, 02:13 PM

I am experiencing the same result as John, where the TextFilterDescriptor does not work unless the term you are searching for matches the case exactly, even after you set the IsCaseSensitive="False".

The example he used was if you used the search term "dive", the result "Divergent" would not show up because the letter "D" was not capitalized, even when the "IsCaseSensitive="False" is set.

I used the Telerik SDK example application posted on Github to test this. I put the Filter on the Country and if I type "Sp" it will show the entries for "Spain", but if it type lowercase "sp" it does not return the entries for "Spain".

Based on that, would it be correct to say the "IsCaseSensitive" does not work as you would expect it to?

 

Jeremy

0
Lance | Senior Manager Technical Support
Telerik team
answered on 17 Sep 2020, 03:23 PM

Hello Jeremy,

Thank you for the report. Indeed, if IsCaseSensitive is set to false, I would expect "sp" to return "Spain" in the results. I will investigate and forward to the dev team if necessary.

To get filtering behavior to work exactly like you want, you can use a Delegate descriptor instead. That will give you ultimate control over the results. Here are the relevant docs and code examples:

If you have any specific issues with your code, please open a Support Ticket here so that I can assign the team responsible for the DataGrid (please include the code you're using so we can give you a direct solution).

Regards,
Lance | Manager Technical Support
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Jeremy
Top achievements
Rank 1
answered on 17 Sep 2020, 04:39 PM

Thank you Lance, I will take a look at the links provided. I appreciate it.

 

Jeremy

0
Yana
Telerik team
answered on 21 Sep 2020, 09:33 AM

Hello Jeremy,

I've tested this in our Programmatic Filtering SDK Example with case-insensitive filter and it worked properly on my side, please take a look at the attached short screencast showing the result.

Could you elaborate more on which example you've tried this and what changes have you made?

I look forward to your reply.

Regards,
Yana
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Jeremy
Top achievements
Rank 1
answered on 21 Sep 2020, 12:49 PM

Hello Yana,

Thank you for the response. I did not try the programmatic filtering example. I tried using the FilteringUIExample from the SDK example code and added the TextFilterDescriptor, setting the IsCaseSensitive="false".

I will try filtering based on the programmatic filter example you referenced and see how that work. Thank you Yana.

 

Jeremy

0
Yana
Telerik team
answered on 21 Sep 2020, 01:44 PM

Hello Jeremy,

Thank you for attaching the image. 

FIlteringUI example shows how you can create custom UI used to filter the grid data  - when app users choose filtering criteria, a TextFilterDescriptor is created based on that criteria (check TemplateColumnFilteringUI.xaml.cs file).  Basically, the TextFilterDescriptor added in XAML (shown in the image) is not used in this case, that's why IsCaseSensitive setting is not applied.

You'd need to set IsCaseSensitive property of the dynamically created TextFilterDescriptor instead:

public override FilterDescriptorBase BuildDescriptor()
{
    TextFilterDescriptor textDescriptor = new TextFilterDescriptor();
    textDescriptor.PropertyName = this.PropertyName;
    textDescriptor.Value = this.textEntry.Text;
    textDescriptor.Operator = (TextOperator)this.descriptorOperatorPicker.SelectedIndex;
    textDescriptor.IsCaseSensitive = false;

    return textDescriptor;
}

Please give it a try and let me know if I can assist with anything else.

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

0
Jeremy
Top achievements
Rank 1
answered on 22 Sep 2020, 03:21 PM

Hello Yana,

I just wanted to follow up and let you know that I have tested both methods  (programmatic filtering and the filteringUI) and both of them worked as expected. Thanks for your help.

Jeremy

Tags
DataGrid
Asked by
Jorge
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
John
Top achievements
Rank 1
Jeremy
Top achievements
Rank 1
Yana
Telerik team
Share this question
or