How do I specify what operators are available in the filter menu?

I want to exclude "startswith" and "endswith" from specific columns in the filter menu. How can I accomplish this? I have found a way to set the default operator, but not a way to exclude any.

1 Reply

AG Ajith Govarthan Syncfusion Team May 6, 2020 11:44 AM UTC

Hi Adam, 

Greetings from Syncfusion. 

Based on your requirement we have prepared sample in that we have showed only specific operators for CustomerName column for that we have used the action begin event.The actionBegin event will triggered with beforefilteropen requestType when click filter icon. In that we have changed the stringOperators  for customerName column. 

We have initially set the total string operators to show all the operators for other string columns we have attached the sample so please refer the sample for your reference. 

Code Snippet:  
app.component.ts 

    actionBegin(args) { 
    if (args.requestType === "filterbeforeopen") { 
      args.filterModel.customFilterOperators.stringOperator = this.stringOperators; 

      if (args.columnName === "CustomerName" && args.columnType === "string") { 
        args.filterModel.customFilterOperators.stringOperator = []; 
        args.filterModel.customFilterOperators.stringOperator = [{ value: "contains", text: "Contains" }, 
        { value: "equal", text: "Equal" }, 
        { value: "notequal", text: "Not Equal" }]; 
      } 
    } 
  } 


Please get back to us if you need further assistance. 

Regards, 
Ajith G. 


Loader.
Up arrow icon