We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Some data do not appear in the list of filters

Hi,


I am displaying data in a grid and using Excel type filters, but some data is not showing up in the list of filters.

I am developing with ASP Core .net6.

The version of Syncfusion.EJ2.AspNet.Core I am using is 20.2.0.43.

UrlAdaptor is implemented to manipulate the data.


The following is the situation


There are two types of data, "real" and "demo", but only "demo" is listed in the filter list.


There are "group37", "group41", "group50", and many more types of data, but only "group1" and "group12" are listed in the filter list.



The other cshtml are made in the same way as the above cshtml, but only the above cshtml is in this situation.

The only possible difference between the above cshtml and the other cshtml is that the above cshtml has a much larger amount of data.

Does the large amount of data cause some data not to be displayed in the filter list?

I would like the list of filters to show all data patterns for that item.

Is there a solution to this problem?



Regards,

Pylori.


4 Replies

PY Pylori November 9, 2022 04:01 AM UTC

Hi,


I will provide additional information about my environment.

The database I am using is CosmosDB.

I am connecting to the database using Microsoft.EntityFrameworkCore.Cosmos.


Regards,

Pylori.



RS Rajapandiyan Settu Syncfusion Team November 9, 2022 01:01 PM UTC

Hi Pylori,


Thanks for contacting Syncfusion support.


From the version 20.1.52, we have provided the support to get the distinct value directly from the server side. You can achieve this by using following code example in the actionBegin event (requestType as filterchoicerequest or filtersearchbegin).


actionBegin: https://ej2.syncfusion.com/javascript/documentation/api/grid/#actionbegin


 

[index.cshtml]

<script>

    function onActionBegin(args) {

        if (args.requestType === filterchoicerequest || args.requestType === filtersearchbegin) {

            var filterfields = [];

            var objFilter = Object.keys(args.filterModel.existingPredicate);

            for (var i = 0; i < objFilter.length; i++) {

                filterfields.push(objFilter[i]);

            }

            filterfields.push(args.filterModel.options.field);

            args.query.distincts = [];

            args.query.select(filterfields); // Created the select query

        }

    }

</script>

 

 

[HomeController.cs]

        public IActionResult UrlDataSource([FromBody] TestDm dm)

        {

            IEnumerable DataSource = BigData.GetAllRecords().AsEnumerable();

            DataOperations operation = new DataOperations();

 

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

            {

                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search

            }

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

            {

                DataSource = operation.PerformSorting(DataSource, dm.Sorted);

            }

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

            {

                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);

            }

            int count = DataSource.Cast<BigData>().Count();

            if (dm.Select != null)

            {

                DataSource = operation.PerformSelect(DataSource, dm.Select);  // Selected the columns value based on the filter request

                DataSource = DataSource.Cast<dynamic>().Distinct().AsEnumerable(); // Get the distinct values from the selected column

            }

            if (dm.Skip != 0)

            {

                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging

            }

            if (dm.Take != 0)

            {

                DataSource = operation.PerformTake(DataSource, dm.Take);

            }

 

            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);

        }


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_distinct_select_excel_filter-1162029447.zip


By default the Excel/ Checkbox filter Dialog in the Grid will display the distinct data from the first 1000 records in grid dataSource to optimize the performance. You can also increase the Excel filter choice count by modifying the filterChoiceCount argument value in the actionBegin event when the requestType is ‘filterchoicerequest’ as demonstrated in the below code snippet,


 

function actionBegin(args){

  if(args.requestType == 'filterchoicerequest' || args.requestType === "filtersearchbegin"){

 

 args.filterChoiceCount = 5000;   // change the filterchoicecount value as you need (the filter check list shown based on this value )

 }

}

 


Find the below documentation for your reference.

https://www.syncfusion.com/kb/13372/how-to-change-the-filter-choice-value-count-for-grid-excel-filter


Regards,

Rajapandiyan S



PY Pylori November 22, 2022 01:40 PM UTC

Hi,


Thank you very much for your answer.

Thanks to you, we were able to solve the said problem.


Regards,

Pylori.



RS Rajapandiyan Settu Syncfusion Team November 23, 2022 03:18 AM UTC

Hi Pylori,


We are happy to hear that you have achieved your requirement with the solution provided.


Please get back to us if you need further assistance.


Regards,

Rajapandiyan S


Loader.
Live Chat Icon For mobile
Up arrow icon