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

Excel filter

Hi 

Is there a way to set the filter of the grid to search the columns with contains operator by default rather than by starts with



7 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team May 16, 2019 12:34 PM UTC

Hi Sahal, 

Greetings from Syncfusion support. 

Query: Is there a way to set the filter of the grid to search the columns with contains operator by default rather than by starts with 
 
We suggest you to use the below way to achieve your requirement. In the below sample, we have bind actionBegin event and override the default operator as contains for checkbox search in Grid. 

Please refer the below code example and sample for more information. 

    <ejs-grid #grid [dataSource]='data' allowPaging='true' allowFiltering='true' [pageSettings]='pageSettings' [filterSettings]='filterSettings' (actionBegin)='actionBegin($event)' > 
        <e-columns> 
            <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column> 
        </e-columns> 
    </ejs-grid> 


actionBegin(args) { 
  if (args.requestType == "filtersearchbegin") { 
    args.operator = 'contains'; 
  } 
} 




Regards, 
Thavasianand S.


SA Sahal May 18, 2019 09:20 AM UTC

Thank you Thavasianand,

Works like charm


HJ Hariharan J V Syncfusion Team May 20, 2019 06:33 AM UTC

Hi Sahal,

Thanks for your update.

We are happy to hear that your requirement has been achieved.

Regards,
Hariharan



SA Sahal July 30, 2019 05:54 AM UTC

Hi Team,

I noticed that when excel filter is set on a grid gobally, no filtering is available on computed column defined by [valueAccessor] property. Please let me know how to achieve the filter on such column.


Another query I have is for the combobox. 
How do we set the initial value using angular 2 way binding. I have [(ngModel)] set to combobox , And if the value is specified before the combobox is created, the combo is rendered with blank text, although the value property is giving the set value


HJ Hariharan J V Syncfusion Team July 31, 2019 12:43 PM UTC

Hi Sahal, 

Thanks for your update. 

Query: when excel filter is set on a grid gobally, no filtering is available on computed column defined by [valueAccessor] property 
 
We have validated the provided information and checked with our end and its working fine at our sample. Could you please share more or below details that will helpful for us validate further at our end.  


  • Did you used allowFiltering false for that column?
  • Did you mean you are not getting any data(it’s not shown any data or not shown valueAccessor value) in excel filter?
  • if possible reproduce the reported problem at our sample and share the scenario to replicate it.
  • Share the code example and package version details

Regards, 
Hariharan 



SA Sahal July 31, 2019 12:54 PM UTC

It happens when the feild is not available on the datasource. Its something that is completely created based on some expression

And I would like to filter on the expression result.
In the sample provided the filter is happening on the base data rather than the computed data.

Sample to reproduce  the error. (added column called new )

https://angular-gridedit-sample-vkkxhc.stackblitz.io

Also should I post another thread to get the answer for my second query 

Another query I have is for the combobox. 
How do we set the initial value using angular 2 way binding. I have [(ngModel)] set to combobox , And if the value is specified before the combobox is created, the combo is rendered with blank text, although the value property is giving the set value


DR Dhivya Rajendran Syncfusion Team August 1, 2019 12:08 PM UTC

Hi Sahal, 

Thanks for your update. 

Query: It happens when the feild is not available on the datasource 
 
It’s necessary to define the field property for columns in Grid to perform actions such as filter, sort, group etc., Please refer the below help documentation for more information. 


Query: How do we set the initial value using angular 2 way binding. I have [(ngModel)] set to combobox , And if the value is specified before the combobox is created, the combo is rendered with blank text, although the value property is giving the set value 

We have prepared the sample with [(ngModel)] for ComboBox component. Please find the sample from below link,  


Regards, 
R.Dhivya    


Loader.
Live Chat Icon For mobile
Up arrow icon