Excel filter doesn´t work correctly

Hello,

I have a problem with excel filter, when I am trying to filter the register called 'test'  but doesn´t appear in the popup to check or uncheck, however if I write it appears in the popup. 



I set these options in grid:

[sortSettings]='sortSettings'  
[allowSelection]="true" 
[filterSettings]='filterSettings' 
[dataSource]='data' 
[allowTextWrap]='true'

where
sortSettings = { columns: [{ field: 'order', direction: 'Ascending' }] };
filterSettings = {type: 'Excel' };




3 Replies 1 reply marked as answer

VS Vignesh Sivagnanam Syncfusion Team November 9, 2020 01:50 PM UTC

Hi PeterXG, 

By default in EJ2 Grid the Excel filter will display the data from the first 1000 records to optimize performance and the other records will be returned as result in the search option of the Filter dialog.  

To overcome the mentioned issue we suggest you to 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; 
        } 
} 

We have prepared a sample for your reference where a unique data is stored at the 1001th record as “Test” and displayed the data in the Excel filter by defining the filterChoiceCount is set to 1500. 


we can also 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); 
        } 
 

Screenshot: 
 

If you still faced the issue, To validate the reported issue further, we request you to share the below details,  

  1. Share the complete Grid code
  2. Please share the issue reproduced sample.
  3. Share the Syncfusion packages version

Regards, 
Vignesh Sivagnanam 


Marked as answer

PE PeterXG November 10, 2020 04:33 PM UTC

I solved the issue increased the excel filter count by modifying the filterChoiceCount.

thank you!


VS Vignesh Sivagnanam Syncfusion Team November 11, 2020 09:45 AM UTC

Hi PeterXG, 

We are happy to hear that the provided solution works fine at your end. 

Please get back to us if you need any further assistance. 

Regards, 
Vignesh Sivagnanam 


Loader.
Up arrow icon