Filtering array fields with in operator

Filtering array fields with in operator seems not working.
Everything works fine before add the in condition for an array field.

@page "/multiselectdropdown-features"
@rendermode InteractiveServer
@using Syncfusion.Blazor
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Data

<PageTitle>MultiSelect Dropdown</PageTitle>

<SfMultiSelect @ref="_multiSelectCountries" TValue="string[]" TItem="Countries" Mode="VisualMode.Default" AllowFiltering="true" Placeholder="Select countries" DataSource="@country">
    <MultiSelectFieldSettings Text="Name" Value="Code"></MultiSelectFieldSettings>
    <MultiSelectEvents TItem="Countries" TValue="string[]" Filtering="OnCountriesFilter" />
</SfMultiSelect>

@code {
    private SfMultiSelect<string[], Countries> _multiSelectCountries;
    public class Countries
    {
        public string Name { get; set; }
        public string Code { get; set; }
        public string[] Aliases { get; set; }
    }
    private List<Countries> country = new List<Countries>
    {
        new Countries() { Name = "Australia", Code = "AU", Aliases = new[] { "Aussy", "Down Under", "Oz" } },
        new Countries() { Name = "Bermuda", Code = "BM", Aliases = new[] { "The Triangle", "BDA" } },
        new Countries() { Name = "Canada", Code = "CA", Aliases = new[] { "CA", "Canuck", "The Great White North" } },
        new Countries() { Name = "Cameroon", Code = "CM", Aliases = new[] { "CMR", "Camer" } },
        new Countries() { Name = "Denmark", Code = "DK", Aliases = new[] { "DK", "Danmark" } },
        new Countries() { Name = "France", Code = "FR", Aliases = new[] { "FR", "République Française", "Hexagon" } },
        new Countries() { Name = "Finland", Code = "FI", Aliases = new[] { "Suomi", "FI" } },
        new Countries() { Name = "Germany", Code = "DE", Aliases = new[] { "Deutschland", "DE", "GER" } },
        new Countries() { Name = "Greenland", Code = "GL", Aliases = new[] { "Kalaallit Nunaat", "GL" } },
        new Countries() { Name = "Hong Kong", Code = "HK", Aliases = new[] { "HK", "HKG" } },
        new Countries() { Name = "India", Code = "IN", Aliases = new[] { "IN", "Bharat", "Hindustan" } },
        new Countries() { Name = "Italy", Code = "IT", Aliases = new[] { "Italia", "IT", "The Boot" } },
        new Countries() { Name = "Japan", Code = "JP", Aliases = new[] { "JP", "Nippon", "Land of the Rising Sun" } },
        new Countries() { Name = "Mexico", Code = "MX", Aliases = new[] { "MX", "México", "Estados Unidos Mexicanos" } },
        new Countries() { Name = "Norway", Code = "NO", Aliases = new[] { "NO", "Norge" } },
        new Countries() { Name = "Poland", Code = "PL", Aliases = new[] { "PL", "Polska" } },
        new Countries() { Name = "Switzerland", Code = "CH", Aliases = new[] { "CH", "Swiss", "Confoederatio Helvetica" } },
        new Countries() { Name = "United Kingdom", Code = "GB", Aliases = new[] { "UK", "Britain", "GB", "England" } },
        new Countries() { Name = "United States", Code = "US", Aliases = new[] { "USA", "US", "America", "The States" } },
    };

    private async Task OnCountriesFilter(Syncfusion.Blazor.DropDowns.FilteringEventArgs args)
    {
        args.PreventDefaultAction = true;

        var orWhere = WhereFilter.Or(new List<WhereFilter> {
            new WhereFilter { Field = "Name", Operator = "contains", value = args.Text, IgnoreCase = true },
            new WhereFilter { Field = "Code", Operator = "equal", value = args.Text, IgnoreCase = true },
            new WhereFilter { Field = "Aliases", Operator = "in", value = args.Text, IgnoreCase = true }
        });

        var query = !string.IsNullOrEmpty(args.Text) ? new Query().Where(orWhere) : new Query();
        await _multiSelectCountries.FilterAsync(country, query);
    }
}



1 Reply

PK Priyanka Karthikeyan Syncfusion Team September 3, 2025 01:31 PM UTC

Hi Yongkee Cho,


When using the Syncfusion MultiSelect component, the DataManager is often utilized for data operations such as filtering and sorting and so on.

 
A key point to consider is that the whereFilter functionality of the DataManager does not natively support an "in" operator in the whereFilter functionality of our DataManager. 

For reference, the following is the list of currently supported operators in the DataManager:
Operator 
Description 
Supported Types
StartsWith 
Checks whether the value begins with the specified value. 
String
DoesNotStartWith
Checks whether the value does not begin with the specified value.
String
EndsWith 
Checks whether the value ends with the specified value. 
String
DoesNotEndWith
Checks whether the value does not end with the specified value.
String
Contains 
Checks whether the value contains the specified value. 
String
DoesNotContain
Checks whether the value does not contain the specified value.
String
Equal 
Checks whether the value is equal to the specified value. 
String | Number | Boolean | Date
NotEqual 
Checks for values not equal to the specified value. 
String | Number | Boolean | Date
GreaterThan 
Checks whether the value is greater than the specified value. 
Number | Date
GreaterThanOrEqual
Checks whether a value is greater than or equal to the specified value. 
Number | Date
LessThan 
Checks whether the value is less than the specified value. 
Number | Date
LessThanOrEqual
Checks whether the value is less than or equal to the specified value. 
Number | Date
IsNull
Returns the values that are null.
String | Number | Date
IsNotNull
Returns the values that are not null.
String | Number | Date
IsEmpty
Returns the values that are empty.
String
IsNotEmpty
Returns the values that are not empty.
String
Between
Filter the values based on the range between the start and end specified values.
Number | Date

Further details are available in the official documentation on Filtering in Blazor DataGrid | Syncfusion


Regards,

Priyanka K


 

Loader.
Up arrow icon