With custom DataAdaptor, only 1 filter is returned

So I have my custom dataAdaptor with works like a charm. However, even if I apply a filter to multiple columns, I only ever get 1 of those.

So this is my code:

public class DataRecordAdaptor : DataAdaptor
{
public override async Task<object> ReadAsync(DataManagerRequest dm, string key = null)
{
if (dm.Where != null && dm.Where.Count > 0)
{
// Filtering
filters = dm.Where.Select(t => CreateListFilter(t.predicates.FirstOrDefault())).ToList();
}

In the above code, dm.Where always has a length of max 1.

Seems like a bug to 


3 Replies 1 reply marked as answer

PS Prathap Senthil Syncfusion Team September 13, 2024 07:15 PM UTC

Hi Henrik Weimenhög,


Based on the query, we would like to clarify if you want multiple filter values. Please check the predicate list to get the filter values. Kindly refer to the code snippet and sample below for your reference.

   if (dm.Where != null && dm.Where.Count > 0)

   {

        var  filters = dm.Where.Select(t => (t.predicates)).ToList();

       // Filtering

       DataSource = Syncfusion.Blazor.DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);

   }


Reference: Class WhereFilter - Blazor API Reference | Syncfusion

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

Regards,
Prathap Senthil


Marked as answer

HW Henrik Weimenhög September 14, 2024 07:46 AM UTC

Thanks for the rapid response!

You are correct, that worked! I was under the assumption that the Where-collection would hold the list of filters but as you point out it is the predicates. A bit confusing but it works so I am happy.


Thanks!



MS Monisha Saravanan Syncfusion Team September 16, 2024 11:49 AM UTC


Hi Henrik,


Welcome. We are glad to hear that the previous response was helpful. Kindly get back to us if you have further queries. As always we will be assist you.






Loader.
Up arrow icon