Grid Filter: Contains is not working

The dropdown for the column filters feature is not working for the "Contains" option. I want to find all the rows which contains the letter "a". The control is forcing me to pick a full value for the column. This is the same behavior as the "Equal" option.

        <SfGrid DataSource="@Entities" ShowColumnChooser="true" Toolbar="@( new List<string>() { "ColumnChooser"})"
                AllowGrouping="true" AllowPaging="true" AllowResizing="true" AllowReordering="true" AllowTextWrap="true"
                AllowSorting="true" AllowFiltering="true">
            <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
            <GridGroupSettings Columns="@GroupedColumns"></GridGroupSettings>
            <GridColumns>
                <GridColumn Field=@nameof(Entity.EntityId) IsPrimaryKey="true" HeaderText="ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
                <GridColumn Field=@nameof(Entity.Name) HeaderText="Name" Width="150"></GridColumn>
                <GridColumn Field=@nameof(Entity.Domain) HeaderText="Domain" Width="150"></GridColumn>
                <GridColumn Field=@nameof(Entity.CreatedOn) HeaderText="Created on" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

                <GridColumn Field=@nameof(Entity.CreatedBy) HeaderText="Created by" TextAlign="TextAlign.Right" Width="120"></GridColumn>
            </GridColumns>
        </SfGrid>

1 Reply 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team September 11, 2020 04:31 AM UTC

Hi Scott,  
 
Thanks for contacting Syncfusion support.  
 
Query: ” The dropdown for the column filters feature is not working for the "Contains" option. I want to find all the rows which contains the letter "a" 
 
We have analyzed your query and we understand that you are want to filter the column using contains operator. By default Filter Operator for string column will be startswith. We suggest you to change the default operator of the Column using FilterSettings property of GridColumn.  
 
Refer the below code example.  
 
<SfGrid DataSource="@Entities" ShowColumnChooser="true" Toolbar="@new List<string>() { "ColumnChooser"})" 
        AllowGrouping="true" AllowPaging="true" AllowResizing="true" AllowReordering="true" AllowTextWrap="true" 
        AllowSorting="true" AllowFiltering="true"> 
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings> 
    <GridGroupSettings Columns="@GroupedColumns"></GridGroupSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Entity.EntityId) IsPrimaryKey="true" HeaderText="ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Entity.Name) HeaderText="Name" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Entity.Domain) HeaderText="Domain" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Entity.CreatedOn) HeaderText="Created on" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn> 
        <GridColumn Field=@nameof(Entity.CreatedBy) HeaderText="Created by" FilterSettings="@(new FilterSettings{ Operator = Operator.Contains })" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</SfGrid> 
  
For your convenience we have prepared a sample which can be downloaded from below  
 
Refer our UG documentation for your reference 
 
 
Kindly get back to us if you have further queries.   
 
Regards, 
Vignesh Natarajan 


Marked as answer
Loader.
Up arrow icon