UPDATED! filterChoiceCount arg is not present in FilterEventArgs.

in this page https://ej2.syncfusion.com/angular/documentation/grid/filtering/#excel-filter

explains how limit the number of rown in wich filters values are searched.


it didnt work for me, then i realise the FilterEventArgs interface didnt have the filterChoiceCount.





I import the FilterEventArgs from: 



and the type for the filter setting is in excel



my package of angular grid and angular are

"@syncfusion/ej2-angular-grids": "^19.4.42",
 "@angular/core": "^12.2.13",

3 Replies

JC Joseph Christ Nithin Issack Syncfusion Team January 18, 2022 12:05 PM UTC

Hi Marco, 

  Greetings from Syncfusion support. 

  On inspecting the provided code example we have found that you are using the type of argument as `FilterEventArgs` in the `actionBegin` event which has the properties that is related to the operations performed during the filter option, hence the FilterEventArgs class will not have . Instead you can use the `FilterSearchBeginEventArgs` which has properties related to the operations performed when the filter dialog box opens and it is ready for searching. Hence the FilterSearchBeginEventArgs contains the property `filterChoiceCount`. 

Please refer the below code example: 


actionBegin(args: FilterSearchBeginEventArgs) { 
    if ( 
      args.requestType === 'filterchoicerequest' || 
      args.requestType === 'filterSearchBegin' 
    ) { 
      args.filterChoiceCount = 1; 
    } 
  } 





  We have also considered this as a improvement in the documentation and we will update the same in the mentioned page and will be rolled out in any of our upcoming releases. 

Please get back to us for further details. 

Regards, 
Joseph I. 



MA Marco Antonio Gallardo January 20, 2022 08:04 AM UTC

Thankyou Very much.


Like you said, i made it work in a simple component, but i have and very complicated one and i only could make it work using the dataChange method.


i suposed it is due to this component has the dataSource like a suscription.


am i right??



JC Joseph Christ Nithin Issack Syncfusion Team January 21, 2022 04:48 PM UTC

Hi Marco, 

  Thanks for your update. 

  By default for each action performed the `actionBegin` event triggers and the type of the argument changes for each action based on the action performed. In your case also  when you perform the filter action the events arguments will be of the type `FilterEventArgs` and before you begin the filter action the argument type will be `FilterSearchBeginEventArgs`. If we use multiple actions the argument type will be different and hence, we have to perform type casting for the arguments based on the action performed and the requestType returned by the arguments. 

  Please refer the below code example. 


actionBegin(args: FilterEventArgs) { 
    if ( 
      args.requestType === 'filterchoicerequest' || 
      args.requestType === 'filterSearchBegin' 
    ) { 
      (args as FilterSearchBeginEventArgs).filterChoiceCount = 1; 
    } 
  } 




Please get back to us for further details. 

Regards, 
Joseph I. 


Loader.
Up arrow icon