Add Current Selection dosent work with limit remote data

Hi!

Im experiencing an issue with the Blazor Grid component when using remote data with a server side limit on the number of returned records.

When the grid is configured to load data remotely and the controller restricts the number of results (for example, returning only 300 records per request), the "Add to Current Selection" functionality on excel filter does not work as expected.

Instead of adding the new selection to the filter records, the grid clears all filters.

I'm Using

OS: Windows 11 (development), Windows Server (production)

Browsers tested: Chrome, Edge

.NET version: .NET 9

Syncfusion Blazor version: 31.1.23

I have a grid with more than 17,000 records, connected to a remote data source that returns a maximum of 300 items per request.

When adding new filter with "Add Current Selection" on excel filter the grid loses all filters for that column.

Steps:

1. Filter one item on a column

2. Try to add other item with "Add Current Selection"

Result:

Filters over that column are gone

Expected behavior:

The grid should retain the previous filter item and add the new filter item to the existing filter.

Example:

Im attaching a minimal example based on your documentation:

A grid with 1000 records, paged by 10, and filtered by a text field.

To reproduce:

On Column Sumary Filter by any value other than Balmy

Then try to add another record (also not Balmy) to the current selection.

The filter resets instead of being cumulative.



Attachment: BUGAddCurrentSelectionGrid_badbc4d0.zip

12 Replies 1 reply marked as answer

PS Prathap Senthil Syncfusion Team October 15, 2025 02:13 PM UTC

Hi Siro Murillo,


Based on the reported issue, it seems that after applying the dm.Take condition, you have used an else clause where the dm.Take value is always set to 10. This has caused a problem during filtering. We would like to clarify that the dm.Take value is only used during the initial rendering and when navigating to the next page. Therefore, we suggest removing that part of the code, as it works fine without it. Kindly refer to the code snippet and the modified sample below for your reference.


   [HttpPost("adaptor")]

   public object Adaptor([FromBody] DataManagerRequest dm)

   {

       IQueryable<WeatherForecast> data = Enumerable.Range(1, 1000).Select(index => new WeatherForecast

       {

           Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),

           TemperatureC = Random.Shared.Next(-20, 55),

           Summary = Summaries[Random.Shared.Next(Summaries.Length)]

       })

       .ToArray().AsQueryable();

       //Ejecuta Busqueda

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

       {

           data = DataOperations.PerformSearching(data, dm.Search);

       }

       // ejecuta orden

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

       {

           data = DataOperations.PerformSorting(data, dm.Sorted);

       }

       // Filtrando

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

       {

           data = DataOperations.PerformFiltering(data, dm.Where, dm.Where.First().Operator);

       }

       int count = data.Cast<WeatherForecast>().Count();

       if (dm.Skip != 0)

       {

           //Paging

           data = DataOperations.PerformSkip(data, dm.Skip);

       }

       if (dm.Take != 0)

       {

           data = DataOperations.PerformTake(data, dm.Take > 10 ? 10 : dm.Take);

       }

       //else

       //    data = DataOperations.PerformTake(data, 10);

 

       return dm.RequiresCounts ? new DataResult() { Result = data, Count = count } : (object)data;

   }


Reference: https://blazor.syncfusion.com/documentation/datagrid/connecting-to-adaptors/url-adaptor

Regards,
Prathap Senthil


Attachment: BUGAddCurrentSelectionGrid_8571dc58.zip


SM Siro Murillo replied to Prathap Senthil October 15, 2025 05:53 PM UTC

Hi, thanks for your response.

Just to clarify — in the sample I shared, the dm.Take = 10 was intentionally added only to reproduce the issue in a simplified way.
In our real scenario, the Grid is bound to a data source with more than 17,000 records, and the API endpoint intentionally limits the response to a maximum of 300 records per request for performance reasons.

If you’re suggesting that we should remove that limitation and return all 17,000+ records each time we open the Excel filter popup or start typing,, that would not be a viable option in production. It would cause a significant delay in data rendering and poor user experience — even when using features like filter choice count, since that feature is applied after the data has already been retrieved from the adaptor.

The problem is that, with remote data limited this way, the “Add to Current Selection” option still clears all previous selections, which is not the expected behavior.

Could you please confirm if there’s a way to preserve selections across filtered or paged data while keeping the data request limit in place?

Thanks again for your help.



PS Prathap Senthil Syncfusion Team October 16, 2025 03:04 PM UTC

Thanks for the update,

Based on the reported issue regarding the delay in loading default values, the Read() method currently needs to return a collection of row-entity objects for all columns — even when only one field is displayed in the filter dialog.To address this issue, we recommend using dm.select to pass only the distinct values. Please refer to the code snippet and the simple sample below for guidance.

    [HttpPost("adaptor")]

    public object Adaptor([FromBody] DataManagerRequest dm)

    {

        IQueryable<WeatherForecast> data = Enumerable.Range(1, 17000).Select(index => new WeatherForecast

        {

            Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),

            TemperatureC = Random.Shared.Next(-20, 55),

              

            Summary = Summaries[Random.Shared.Next(Summaries.Length)]

        })

        .ToArray().AsQueryable();

        //Ejecuta Busqueda

 

        // ejecuta orden

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

        {

            data = DataOperations.PerformSorting(data, dm.Sorted);

        }

        if (dm.Select != null)

        {

            data = PerformSelect<WeatherForecast>(data.AsQueryable(), dm.Select);

        }

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

        {

            data = DataOperations.PerformSearching(data, dm.Search);

        }

          

          

        // Filtrando

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

        {

            data = DataOperations.PerformFiltering(data, dm.Where, dm.Where.First().Operator);

        }

        int count = data.Cast<WeatherForecast>().Count();

        if (dm.Skip != 0)

        {

            //Paging

            data = DataOperations.PerformSkip(data, dm.Skip);

        }

        if (dm.Take != 0)

        {

            data = DataOperations.PerformTake(data, dm.Take);

        }

 

        return dm.RequiresCounts ? new DataResult() { Result = data, Count = count } : (object)data;

    }

 

 

    public static IQueryable<T> PerformSelect<T>(IQueryable<T> source, IEnumerable<string> selectFields)

    {

        if (source == null) throw new ArgumentNullException(nameof(source));

        if (selectFields == null) throw new ArgumentNullException(nameof(selectFields));

 

        var field = selectFields.FirstOrDefault(f => !string.IsNullOrWhiteSpace(f));

        if (string.IsNullOrWhiteSpace(field))

        {

            return source;

        }

 

        return source

            .AsEnumerable()                             

            .GroupBy(item => GetMemberValue(item, field))

            .Select(group => group.First())

            .AsQueryable();

    }

 

    private static object? GetMemberValue(object instance, string memberPath)

    {

        var current = instance;

        foreach (var part in memberPath.Split('.', StringSplitOptions.RemoveEmptyEntries))

        {

            if (current == null) return null;

 

            var member = current.GetType().GetProperty(part) ??

                         throw new ArgumentException($"Property '{part}' was not found on type '{current.GetType().Name}'.", nameof(memberPath));

 

            current = member.GetValue(current);

        }

        return current;

    }

 

 

 

 

}

 




Attachment: BUGAddCurrentSelectionGrid_Modified_d8dbbe95.zip


SM Siro Murillo replied to Prathap Senthil October 16, 2025 10:28 PM UTC

Hi, thanks for your follow-up and for the suggestion regarding dm.Select.

We’ve updated the sample to use a country catalog to make the scenario more realistic.
The controller response is still limited to 10 records per request, while the full catalog contains 194 countries.

We’ve implemented the dm.Select option as recommended.

To reproduce the issue:

  1. Filter starting from a record after the 10th, for example from Austria onward.

  2. For example, first filter Mexico.
    Image_9153_1760653177818

  3. Then filter India and choose Add to Current Selection.
    Image_1510_1760653269979
    → At this point, all filters are cleared automatically.

So, even after applying dm.Select, the issue persists — the grid still resets the filters when trying to add to the current selection.

Could you please review this behavior again?

Thanks for your help.


Attachment: BUGAddCurrentSelectionGridCountry_ba0bfced.zip


PS Prathap Senthil Syncfusion Team October 17, 2025 05:27 PM UTC

We would like to inform you that to improve performance, as mentioned in our previous update, we recommended using the dm. select solution to pass only distinct values. This approach helps optimize performance.



We suggest removing the else clause where dm.Take is always set to 10, as this is not the correct implementation and have caused the filtering operation to behave unexpectedly. Thank you for your understanding.

if (dm.Take != 0)

{

     data = DataOperations.PerformTake(data, dm.Take);

}

 

// data = DataOperations.PerformTake(data, 10);




To resolve the issue with multiple filtering, we suggest using the code snippet below. Kindly refer to it along with the sample provided for your reference.

Reference:
https://blazor.syncfusion.com/documentation/datagrid/connecting-to-adaptors/url-adaptor#handling-filtering-operation

public object Adaptor([FromBody] DataManagerRequest dm)

{

    IQueryable<Country> data = CountryData.GetAllCountries().AsQueryable();

           

    //Ejecuta Busqueda

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

    {

        data = DataOperations.PerformSearching(data, dm.Search);

    }

    // ejecuta orden

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

    {

        data = DataOperations.PerformSorting(data, dm.Sorted);

    }

    if (dm.Select != null)

 

    {

        data = PerformSelect<Country>(data.AsQueryable(), dm.Select);

    }

    //// Filtrando

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

    //{

    //    data = DataOperations.PerformFiltering(data, dm.Where, dm.Where.First().Operator);

    //}

 

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

    {

        foreach (var condition in dm.Where)

        {

            foreach (var predicate in condition.predicates)

            {

                data = DataOperations.PerformFiltering(data, dm.Where, predicate.Operator);

                // Add custom logic here if needed and remove above method.

            }

        }

    }

    int count = data.Cast<Country>().Count();

    if (dm.Skip != 0)

    {

        //Paging

        data = DataOperations.PerformSkip(data, dm.Skip);

    }

    if (dm.Take != 0)

    {

        data = DataOperations.PerformTake(data, dm.Take);

    }

 

    //Take 10 records intentionally

   // data = DataOperations.PerformTake(data, 10);

 

    return dm.RequiresCounts ? new DataResult() { Result = data, Count = count } : (object)data;

}


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BUG-AddCurrentSelectionGrid



SM Siro Murillo replied to Prathap Senthil October 17, 2025 11:16 PM UTC

Hi, thanks again for your reply.

I believe there might be a misunderstanding about the issue being reported.
The problem is not related to the use of dm.Take or data pagination. The real issue is that when using “Add to Current Selection”, the grid clears all filters instead of keeping them — and this happens specifically when the server limits the number of returned records, such as when using Take or any other server-side cap on the dataset.

To make this clearer, I modified the sample and included two grids using the same dataset (around 52,000 records):

  • The first grid uses Take = 10, just like the original sample — this one replicates the bug I reported.

  • The second grid follows the approach you recommended, returning all records without applying Take — and as expected, it completely freezes or crashes the browser due to the large amount of data being handled in memory.

As mentioned before, in real production scenarios we cannot remove the Take restriction because it’s essential for performance. Returning the entire dataset at once is simply not viable, as it causes severe slowdowns and memory issues, even on high-end machines.

So again, the issue is not the Take limit itself, but the fact that when the server enforces a record limit, using “Add to Current Selection” causes the grid to reset or clear the filters unexpectedly.

Could you please recheck this specific behavior? The bug consistently appears only when the server-side data limit is active — which is a very common and necessary practice in real-world remote data implementations.

👉 Inside the attached ZIP file, I’ve included a short video demonstrating the issue in action, so you can clearly see the difference between both grids and how the problem occurs.

Thanks for your patience and understanding.


Attachment: finalexample_9279fd27.zip


AM Arturo montes October 22, 2025 05:22 PM UTC

Hi Syncfusion Team,

I’d like to urgently follow up on this issue, as I’m also experiencing the exact same behavior described above.

When using remote data with a server-side limit (in my case, 300 records per request), the “Add to Current Selection” option in the Excel filter consistently clears all previous filters instead of adding to them. This is not the expected behavior and severely impacts usability.

Removing the data limit is not a viable solution in production due to performance constraints. Likewise, migrating to BlazorApp or BlazorServer is not an option in my case, as it would require significant architectural changes that are not feasible at this stage.

This issue clearly occurs only when the server enforces a record cap — which is a standard practice in real-world applications.

Please confirm whether this behavior is being actively investigated and if a fix or workaround is planned. This needs urgent attention, as it affects core functionality in scenarios involving large datasets.

Thank you,



PS Prathap Senthil Syncfusion Team October 23, 2025 02:56 AM UTC


Sorry for the inconvenience.


Based on the reported issue, we would like to inform you that the by default Excel Filter dialog only considers the first 1,000 records from the grid’s dataSource. This limitation is due to performance optimization in the Excel Filter dialog.

When a value beyond the first 1,000 records is searched and combined with the “Add Current Selection” option, it does not work as expected. This is because the search operation only checks within the first 1,000 records. If the searched value is not found within that range, the filter will be cleared. This is the current behavior.

For example, with 5,000 records, filtering within the first 1,000 records works fine. However, if you filter the 4,999th record, reopen the filter, search for the 5,000th record, select "Add Current Selection," and click the filter button, the filter will not work. If you want the "Add Current Selection" feature to work for all records, you need to set the FilterChoiceCount to match the total count of the dataSource in the FilterDialogOpening event. However, please note that this may impact the performance of the Excel Filter dialog.

For your reference, we have attached a code snippet and sample.


<SfGrid TValue="Country" ID="Grid" AllowFiltering="true" AllowExcelExport="true"

AllowPaging Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">

    <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Syncfusion.Blazor.Adaptors.CustomAdaptor"></SfDataManager>

    <GridPageSettings PageSize="10" />

    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>

    <GridEvents FilterDialogOpening="FilterDialog" TValue="Country"></GridEvents>

 

    <GridColumns>

       --------------

</SfGrid>

 

@code {

    public static List<Country> Orders { get; set; }

 

    protected override void OnInitialized()

    {

 

    }

 

    public async Task FilterDialog(Syncfusion.Blazor.Grids.FilterDialogOpeningEventArgs args)

    {

        args.FilterChoiceCount = 5000;

    }
}


Sample:
https://blazorplayground.syncfusion.com/rthIMXBhpCJrvpfK


Reference:
https://blazor.syncfusion.com/documentation/datagrid/excel-like-filter#customize-the-filter-choice-count



SM Siro Murillo October 24, 2025 03:32 PM UTC

We’ve decided to resolve this on our side by hiding the “Add to Current Selection” option, since in our project it’s not feasible to load thousands of records into memory repeatedly just to make that feature work correctly.

Given our data volumes and performance requirements, retrieving all records at once is not a practical or scalable solution.


<style>

    .e-ftrchk {

        display: none;

    }

    .e-ftrchk[uid] {

        display: block;

    }

</style>





NP Naveen Palanivel Syncfusion Team October 30, 2025 04:13 AM UTC

Hi Siro Murillo,

We have considered your request as an improvement at our end and logged a task “Support Virtualization in Excel-like Filter Dialog for Large Filter Checkbox Data”. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. And this improvement will be included in any of our upcoming releases. 


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.


https://www.syncfusion.com/feedback/70966/support-virtualization-in-excel-like-filter-dialog-for-large-filter-checkbox-data

You can also communicate with us regarding the open feature any time using our above feedback report page. We do not have immediate plan to implement this feature and it will be included in any of our upcoming releases. Please cast your vote to make it count. So that we will prioritize the improvement for every release based on demands.

Regards,
Naveen


Marked as answer

SM Siro Murillo replied to Naveen Palanivel October 30, 2025 03:47 PM UTC

Thanks 🙂



PS Prathap Senthil Syncfusion Team November 3, 2025 04:52 AM UTC

Thank you for the update.

We’re glad to hear that the information provided was helpful. You can now track the current status of your request, review the proposed resolution timeline, and reach out to us for any further inquiries using the link above.


Loader.
Up arrow icon