We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Filter Menu default operator

Hi
I'm using filter menu for filtering in columns of my grids.
in the documents it said there's a solution for changing the default operator of filterbar, it doesn't work for filter menu.
how can I change the default operator of filter menu?
thanks in advance.

4 Replies

MS Madhu Sudhanan P Syncfusion Team March 29, 2019 05:40 AM UTC

Hi Nastaran, 

Thanks for contacting us. 

You can change the order of the operator collection which is used default by the columns as follows in the dataBound event. With the below code, now string columns uses the contains as its default operator. 


    public dataBound(): void { 
        (<any>this.grid.filterModule).customOperators.stringOperator =  
        (<any>this.grid.filterModule).customOperators.stringOperator.sort(function(x,y){ 
          return x.value == 'contains' ? -1 : y.value == 'contains' ? 1 : 0; 
        }); 
    } 


 


If you want to change the operator list for other type columns, please change the order from the below properties of the customOperators. 

Number 
numberOperator 
Boolean 
booleanOperator 
Date 
dateOperator 
DateTime 
datetimeOperator 
 

Regards, 
Madhu Sudhanan P 



NA Nastaran March 30, 2019 04:18 AM UTC

thanks very much. it worked


TS Thavasianand Sankaranarayanan Syncfusion Team April 1, 2019 06:08 AM UTC

Hi Nastaran, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.


MS Madhu Sudhanan P Syncfusion Team April 2, 2019 05:10 AM UTC

Hi Naazaniqua, 
  
Thanks for the update. 
  
Regards, 
Madhu 


Loader.
Live Chat Icon For mobile
Up arrow icon