Search in Excel Filter return no values

Hi,

I'm using a Grid with a DataManager connected to a REST endpoint.

When the page loads, the filters are correctly populated : see #1

However, after performing a search, all filter options disappear : see #2


I can see that a query is sent to the data source: see #3

 and the response contains data : see #4

There are no errors in the browser console.

What should I look into to resolve this?

Thank you,



Attachment: ScreenShot_cfb15dae.png

2 Replies

EC Ecaldima May 12, 2025 09:20 AM UTC

I identified the root cause of the issue: my REST endpoint was not handling the requiresCounts property correctly. This property is set to true during the initial load or refresh of the datasource, but it is not set during filtering operations, and I was always sending the results/count .

Hope that helps



SR Sivaranjani Rajasekaran Syncfusion Team May 12, 2025 11:14 AM UTC

Hi Ecaldima, 

Thank you for the detailed explanation. Based on your findings, you are correct — the issue occurs because the REST endpoint does not properly handle the requiresCounts property during filtering operations.


The Grid expects different response formats based on whether the requiresCounts parameter is present in the query:

  • For general Grid actions (such as initial load, paging, sorting, or refreshing the data source):
    • The requiresCounts parameter will be true.
    • In this case, the server must return a response in the format { result: [...], count: totalCount }.
  • For search or filtering within the filter popup (Excel or menu filter search):
    • The requiresCounts parameter will be undefined.
    • Here, the server should return a plain array of objects — only the filtered data without wrapping it inside a { result: [...], count: ... } object.
To resolve the issue, you should adjust your backend to check for the requiresCounts parameter and return the response accordingly.

Please refer to the code below for more information:

Code Example : 

   public object Post([FromBody] DataManagerRequest DataManagerRequest)
        {
            // Retrieve data from the data source (e.g., database)
            IQueryable<OrdersDetails> DataSource = GetOrderData().AsQueryable();

            QueryableOperation queryableOperation = new QueryableOperation(); // Initialize DataOperations instance

            // Handling filtering operation
            if (DataManagerRequest.Where != null && DataManagerRequest.Where.Count > 0)
            {
                DataSource = 
                                    queryableOperation.PerformFiltering(DataSource.Cast<OrdersDetails>(), 
                                    DataManagerRequest.Where, 
                                    DataManagerRequest.Where[0].Operator);
            }

            // Get the total count of records
            int totalRecordsCount = DataSource.Count();

            // Handling paging operation.
            if (DataManagerRequest.Skip != 0)
            {
                DataSource = queryableOperation.PerformSkip(DataSource, DataManagerRequest.Skip);
            }
            if (DataManagerRequest.Take != 0)
            {
                DataSource = queryableOperation.PerformTake(DataSource, DataManagerRequest.Take);
            }

            // Return data based on the request
            return DataManagerRequest.RequiresCounts ? 
                             new { result = DataSource, count = totalRecordsCount }: 
                             new { result = DataSource };
        }

Screenshot:

Sample : Please find the sample attached.

Please get back to us if you need further assistance.

Regards,
Sivaranjani R.


Attachment: UrlAdaptorJS_57f37bb8.zip

Loader.
Up arrow icon