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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Columns filters not showing all available options: search not working

Thread ID:

Created:

Updated:

Platform:

Replies:

141605 Dec 20,2018 09:12 AM UTC Dec 24,2020 12:02 PM UTC ASP.NET MVC - EJ 2 4
loading
Tags: Grid
Charles Southey
Asked On December 20, 2018 09:12 AM UTC

Hi,

We have a fairly urgent problem to resolve with the Grid control. The columns filters only show  a subset of the available options in each column to filter on (5 + all)  - and there does not seem to be any way to control this. If we could boost this up to 10 it would meet our need. The Search facility on the filter columns also does not seem to be working for any of the filter styles - we can trace the requests back to the datasource and see that it is returning the correct results to the grid, but the filter box in the grid seems to ignore that an always just shows "No Results Found" no matter what the search term is.
 


Charles Southey
Replied On December 20, 2018 11:25 PM UTC

I have partially got to the bottom of this: it appears that the grid samples the first 1,000 records to get values for the filters: we have put our own filters to restrict the data set so it does not go over that. However we still have the problem with the search not working - and it would be helpful to get more information server-side on data retrievals triggered by opening a filter list so we can control how the filter list gets its data  (and make it much more efficient).  Simply grabbing all the data every time is a very inefficient way of doing this -we can write server-side code that intelligently supplies the right values.


Madhu Sudhanan P [Syncfusion]
Replied On December 21, 2018 10:35 AM UTC

Hi Charles, 

Greetings from Syncfusion. 

Query #1: Simply grabbing all the data every time is a very inefficient way of doing this -we can write server-side code that intelligently supplies the right values. 
 
We have validated your query and we suggest to use the addParams method of the query property to achieve your requirement. In the below sample, using actionBegin event when requestType is filterbeforeopen we have passed a variable and in the controller based on this value you can change datasource provided to create the filter items in excel filter. Please refer to below sample and documentation for your reference, 

Code Example:  

[.cshtml] 
... 
function begin(args) { 
        if (args.requestType == 'filterbeforeopen') { 
            cloneQuery = this.query; 
            this.query = new ej.data.Query().addParams("excelfilter", true); 
        } 
    }... 
[.cs] 
... 
if (dm.excelfilter
            { 
                DataSource = operation.PerformTake(DataSource, 2);    //we have just passed the first two records to the excel filter items 
                //You can change the filter data according to your requirement here 
            } 
... 



Query #2: The Search facility on the filter columns also does not seem to be working for any of the filter styles - we can trace the requests back to the datasource and see that it is returning the correct results to the grid, but the filter box in the grid seems to ignore that an always just shows "No Results Found" no matter what the search term is. 

Before we start working on this query, please provide the below mentioned information or details. It will help us provide better solution as soon as possible, 

  1. not seem to be working for any of the filter styles” here what do you mean by ‘filter styles’, please explain in detail on this?
  2. By default ‘number’ and ‘date’ fields are set with ‘equal’ operator while searching from excel filter, so please provide more details about the fields?
  3. Please share your full grid server and client side code example?
 
Regards, 
Madhu Sudhanan P 


Marcos
Replied On December 23, 2020 08:21 PM UTC

Hello everyone, this is my issue right now using the last version. The issue its in the filter of cuorse
You can see Access Staffing at first row.
But not appear on the filter until you type that option

Once you type the option:


Thanks for any help you can provide to me.

Regards, Marcos



Rajapandi Ravi [Syncfusion]
Replied On December 24, 2020 12:02 PM UTC

Hi Charles, 

Thanks for the update 

We have analyzed your query and we could see that you like to show the different choices which was exist in the datasource. By default the Excel filter in the Grid will display the data from the first 1000 records to optimize performance. The other records will be returned as result in the search option of the Filter dialog. This is the default behavior of Grid.  

You can increase the Excel filter count by modifying the filterChoiceCount argument value in the actionBegin event when the requestType is ‘filterchoicerequest’ as demonstrated in the below code snippet, 

// Grid’s actionBegin event function 
function onActionBegin(args) { 
        if (args.requestType === "filterchoicerequest") {‘ 
            // Filter choice count is modified 
            args.filterChoiceCount = 1500;  //modify value here as you want 
        } 
} 

Or we can achieve this requirement by using custom dataSource (Distinct value dataSource) for required filter column.  If you are using remote data , we suggest you to return the unique values from the server. To return the unique value from server side you have to create a select query in actionBegin event. Please refer the below code example for more information. 
 
 
<script> 
    function begin(args) { 
       if (args.requestType === "filterchoicerequest") { 
            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> 
 

 
 
public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = order; 
            DataOperations operation = new DataOperations(); 
. . . . . . . .  
            int count = DataSource.Cast<Orders>().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  
            } 
. . . . . .  
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
 


Regards, 
Rajapandi R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon