Match on text substring for filter

Hi,

I would like to have a row returned in case the filter is partially matched, so filtering on 'ZAR' should return 'AUD.ZAR' and 'GBP.ZAR'. What should I do to achieve that? Is it a setting in GridFilterSettings, or should I code for that? If yes, can you point me towards an example?

Thanks, Johan

1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team March 30, 2021 12:32 PM UTC

Hi Johan, 

Greetings from Syncfusion. 

Query: I would like to have a row returned in case the filter is partially matched, so filtering on 'ZAR' should return 'AUD.ZAR' and 'GBP.ZAR'.  

We have validated your query and we suggest you to achieve your requirement by changing the Filter operator to Contains in FilterSetttings. Find the below code snippets and documentation for your reference. 

@using Syncfusion.Blazor 
@using Syncfusion.Blazor.Grids 
 
<SfGrid DataSource="@Orders" AllowFiltering="true"> 
    <GridFilterSettings ></GridFilterSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" FilterSettings="@(new FilterSettings{ Operator = Operator.Contains })" Width="150"></GridColumn> 
       . . . 
    </GridColumns> 
</SfGrid> 
 
@code{ 
    public List<Order> Orders { get; set; } 
    . . . 
} 

Operator  
Description  
Supported Types 
Contains  
Checks whether the value contains the specified value.  
String 


Reference

Please let us know if you have any concerns. 

Regards, 
Rahul 


Marked as answer
Loader.
Up arrow icon