Column filter not working when searching with last characters

Hi Team,

Unable to perform filter when searching with
Here I have added a sample, where I want to filter Document number column which has 78​ in its string
I have also tried setting :matchCase: 'false'.
Sample codesandbox: https://codesandbox.io/s/vue-template-forked-p94x6


Actual result: No Records to display
Expected output: Results which contain document number with 78


Regards,
Sandeep G


3 Replies

RS Rajapandiyan Settu Syncfusion Team October 29, 2021 11:45 AM UTC

Hi Sandeep, 
  
Greetings from Syncfusion support. 

By analyzing your query, we suspect that you want to perform filtering with “contains” operator for DocumentNumber column. Before proceeding your requirement, We would like to share the behavior of filter operators in EJ2 Grid.   

By default, the “startswith” operator is applied to filter a string type column and “equal” operator is applied to filter a number type column in the Grid. 

You have the option to change the default filter operator for particular column by using filter property of Column Model. Refer to the below code example. 


 
<template> 
  <div id="app"> 
    <ejs-grid 
      ref="grid1" 
      :dataSource="data" 
      :allowPaging="true" 
      :allowFiltering="true" 
      :filterSettings="filterOptions" 
      :dataBound="dataBound" 
    > 
      <e-columns> 
        ---- 
        <e-column 
          field="DocumentNumber" 
          headerText="DocumentNumber" 
          width="180" 
          headerTextAlign="center" 
          :filter="filterOptions" 
        ></e-column> 
        ---- 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 
<script> 
-- 
export default { 
  data() { 
    return { 
      --- 
      filterOptions: { operator: "contains"}, 
    }; 
  }, 
  --- 
}; 
</script> 
 


If you want to change the default filter operator for all the string type column, use below code in the dataBound event of Grid. 
 


 
   dataBound: function (args) { 
      var gridObj = this.$refs.grid1.$el.ej2_instances[0]; 
      Object.assign(gridObj.filterModule.filterOperators, { 
        startsWith: "contains", // change the default operator as contains for string type column 
      }); 
    }, 
 



Please get back to us if you need further assistance with this. 
  
Regards,  
Rajapandiyan S 



SG Sandeep G November 15, 2021 09:14 AM UTC

Hi  Rajapandiyan,

Thanks for resolving my query.

Regards,
Sandeep G



RS Rajapandiyan Settu Syncfusion Team November 16, 2021 03:51 AM UTC

Hi Sandeep, 
 
We are glad that you have achieved your requirement with the provided solution. 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rajapandiyan S 


Loader.
Up arrow icon