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

Grid Column filtering (menu type with checkbox) how to change to "contains" logic

Hi

This question is in reference to Grid Column Filtering (using "Menu Type" with checkboxes):


In above link when you click filter icon of "Employee Name"  and then start typing few characters, the pop-up dropdown list is filtered using "BeginsWith" logic.

How can I change it so it filters using "contains" logic? (please note, I'm not referring to grid filtering itself, but rather to filtering of column dropdown options list)

Must be something simple but could not find it anywhere in documentation

Thanks
Alex



3 Replies

PS Pavithra Subramaniyam Syncfusion Team December 30, 2019 11:15 AM UTC

Hi Alex, 
 
Greetings from Syncfusion support.   
   
You can achieve your requirement by overriding the operator inside the actionBegin event for ‘filtersearchbegin’ request. Please refer to the below code example, Documentation and sample link for more information. 
 
<template> 
  <div id="app"> 
    <ejs-grid id="Grid" ref="grid" allowFiltering=true :filterSettings='filter' :actionBegin='actionBegin' :dataSource="data"> 
      <e-columns> 
        <e-column field="OrderID" headerText="Order ID" width="90"></e-column> 
        <e-column field="CustomerID" headerText="Customer ID" format="C2" width="90"></e-column> 
        <e-column field="ShipCity" headerText="Telefon" width="150" textAlign="Center"></e-column> 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 
 
<script> 
.  .  . 
 
export default { 
  data() { 
    return { 
      data: data, 
      filterSettings:{type:"CheckBox"} 
    } 
      }, 
  methods: { 
    actionBegin:function(e){ 
       if(e.requestType === 'filtersearchbegin' && e.columnName === 'CustomerID'){ 
          e.operator = 'contains'; 
     } 
    } 
  }, 
 
  provide: { 
    grid: [PageFilter] 
  } 
}; 
</script> 
 
 
 
Sample               : https://codesandbox.io/s/checkbox-search-operator-mms2d 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 



AE Alex E January 2, 2020 02:28 PM UTC

Thanks Pavithra!


DR Dhivya Rajendran Syncfusion Team January 3, 2020 06:43 AM UTC

Hi Alex, 

We are happy that the provided solution was helpful to achieve your requirement. Please get back to us if you need further assistance from us. 

Regards, 
R.Dhivya 


Loader.
Live Chat Icon For mobile
Up arrow icon