Filtering with OR across multiple columns in DataGrid

Imagine a grid of cars with fields like: ID, Name, Type, Color

I would like to filter for entries with Type=SUV OR Color = Red. The results would include Red cars which are and are not SUVs, and SUVs which are and are not Red.

Is there a way to do this within SyncFusion? If so, please provide an example and explanation. My current exploration finds that the behavior is to treat multiple filters on different columns as strictly an AND predicate


3 Replies

PS Prathap Senthil Syncfusion Team August 11, 2025 01:47 PM UTC

Hi  Mark Hill,



Based on your requirement, we would like to inform you that the DataGrid’s built-in filtering applies an AND predicate. When you filter by multiple columns, it displays only rows that match all the specified conditions. The DataGrid supports different filtering operators and provides four filtering modes—FilterBar, Menu, Checkbox and Excel. You can choose any of these filtering modes to achieve your specific requirements. For more information, please refer to our documentation and demos at the link below.


Documentation: Filtering in Blazor DataGrid | Syncfusion

Demo : Blazor DataGrid Filtering | Data Filters | Syncfusion


Regards,
Prathap Senthil



MH Mark Hill August 11, 2025 01:51 PM UTC

I'm not sure you actually answered my question in there at all.

Can you confirm whether or not, within DataGrid, there is a way to filter for Column A = something OR Column B = something?

I am aware that the default behavior does not do this, and that as far as I can tell, the documentation does not cover this case, so neither of those are helpful.

If this can be done, please provide an example of how it is done.

If not, consider this a feature request.



PS Prathap Senthil Syncfusion Team August 12, 2025 12:27 PM UTC

Yes, this is possible to implement an "OR" condition for filtering across different columns in the DataGrid. We recommend generating a list of predicates using WhereFilter and then assigning the combined predicate to the grid's Query property to perform the filtering operation.Please refer to the code snippet and our documentation for a complete example.

  public void ClearFilter()

  {

      QueryData = new Query();

  }

 

  public void Filter()

  {

      var Col1Pre = new WhereFilter();

 

      var predicate = new List<Syncfusion.Blazor.Data.WhereFilter>();

 

      predicate.Add(new WhereFilter() { Field = "CustomerID", value = "SUPRD", Operator = "equal" });

      predicate.Add(new WhereFilter() { Field = "ShipCity", value = "Reims", Operator = "equal" });

      Col1Pre = Syncfusion.Blazor.Data.WhereFilter.Or(predicate);

      QueryData = new Query().Where(Col1Pre);

 

  }

 


Reference:

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.WhereFilter.html

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.WhereFilter.html#Syncfusion_Blazor_Data_WhereFilter_And_Syncfusion_Blazor_Data_WhereFilter_

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.WhereFilter.html#Syncfusion_Blazor_Data_WhereFilter_Or_Syncfusion_Blazor_Data_WhereFilter_

Sample:
https://blazorplayground.syncfusion.com/embed/BjroDbCVfhdnvQAr?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5


Loader.
Up arrow icon