Incomplete excel filters

Hello,

I have a grid containing 38,000 records. In my first column, I only have three values : Budget (17,000 records), Forecast (12,000 records) and S&OP (9,000 records). Excel filter is only showing "Budget" checkbox...
Is it a bug, or is there a way to set it ?

Thanks a lot !

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team August 17, 2018 10:31 AM UTC

Hi Johann, 
 
Thanks for contacting Syncfusion support. 
 
Based on your query we suspect that you have bound remote data in Grid. So, we have prepared a sample in URL Adaptor and we are able to reproduce the reproduce the reported issue from our end. By default, in excel we have provided inbuilt support to limit the data(unique values) that has been rendered in checkbox filter of excel filter dialog using maxFilterChoice property of filterSettings. So, it display only the Budget in checkbox filter of excel filter dialog.  
 
To avoid this, we need to send the unique values from the server-side using Select query and Distinct method. In the below code example we have passed the current filtering column in select query using actionBegin event of ejGrid. In server-side we used Select query and Distinct method to get the corresponding column with unique values and returned from the server-side. 
 
Find the code example:  
 
 
GridFeatures.cshtml] 

@(Html.EJ().Grid<object>("Grid") 
                     .Datasource(ds => ds.URL("/Grid/UrlDataSource").Adaptor("UrlAdaptor")) 
                     ... 
                     .Columns(col => 
        { 
            ... 
               .ClientSideEvents(eve => eve.ActionBegin("onActionBegin")) 
) 
<script> 
 
        function onActionBegin(args) { 
            if (args.requestType == "filterchoicerequest") { 
                //selects only the filtering column 
                //which prevents the serialization errror. 
                args.query.select(args.filterModel.fName); 
            } 
        } 
 
</script> 


----------------------------------------------------------- 
[GridController.cs] 

public ActionResult UrlDataSource(DataManager dm) 
        { 
            BindDataSource(); 
            IEnumerable data = order; 
            DataOperations operation = new DataOperations(); 
 
 
               ----- 
 
             
            if (dm.Select != null) 
            { 
                data = operation.PerformSelect(data, dm.Select); 
                data = data.Cast<dynamic>().Distinct().AsEnumerable(); 
            } 
            if (dm.Skip != 0) 
            { 
                data = operation.PerformSkip(data, dm.Skip); 
            } 
            if (dm.Take != 0) 
            { 
                data = operation.PerformTake(data, dm.Take); 
            } 
            if (dm.RequiresCounts ) 
                return Json(new { result = data, count = count }); 
             
            else  
                return Json(data, JsonRequestBehavior.AllowGet); 
 
        } 
 
 
We have prepared a sample and it can be downloadable from the below location. 


Refer the help documentation. 

 
Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon