Unique values for Excel filter

Hi. How to return ALL unique values for Blazor DataGrid excel filter checkbox (not only distinct values from the first 1000 records of Grid dataSource)?

3 Replies 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team August 5, 2020 06:20 AM UTC

Hi Costa, 

Greetings from Syncfusion. 

Query: How to return ALL unique values for Blazor DataGrid excel filter checkbox (not only distinct values from the first 1000 records of Grid dataSource)? 

We have validated your query and by default, in Excel type filter the filter choice record count is limited to 1000 (take first 1000 records and then apply distinct value)for better performance. So only the first thousand records is fetched in the filter choices. To overcome this default behavior, you can set the filter choice record count as per your requirement by setting the desired count for “FilterChoiceCount” in “OnActionBegin” event.  

Please use the code below,  

 
<SfGrid DataSource="@Orders" AllowFiltering="true"> 
        <GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents> 
        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings> 
        . . . 
    </SfGrid> 
@code{ 
       ... 
 
       public void ActionBeginHandler(ActionEventArgs<Order> args) 
       { 
           if(args.RequestType == Syncfusion.Blazor.Grids.Action.FilterChoiceRequest) 
           { 
              args.FilterChoiceCount = 2000;     //here, you can override the default take count of the filter records 
           } 
        } 
} 


Please get back to us if you need further assistance. 

Regards, 
Rahul 


Marked as answer

CO Costa August 6, 2020 10:36 AM UTC

Thanks.


RN Rahul Narayanasamy Syncfusion Team August 7, 2020 04:45 AM UTC

Hi Costa, 

Thanks for the update. 

Please get back to us if you need further assistance. 

Regards, 
Rahul 


Loader.
Up arrow icon