- Home
- Forum
- React - EJ 2
- Filter operator contains
Filter operator contains
Good afternoon,
How can I change the default filter operator 'startswith' to 'contains' in the grid?
thanks in advance!
SIGN IN To post a reply.
3 Replies
MF
Mohammed Farook J
Syncfusion Team
October 15, 2018 11:58 AM UTC
Hi Társis,
Thanks for contacting Syncfusion support.
Query: How can I change the default filter operator 'startswith' to 'contains' in the grid?
We have validated your query and you can achieve your requirement by using below way.
Here, we have changed the default filter operator from ‘startwith’ to ‘contains’ by using dataBound event. Please find the below code example and sample for your reference.
[code example]
|
...
export class Filtering extends SampleBase {
constructor() {
super(...arguments);
...
}
dataBound(){
Object.assign(this.gridInstance.filterModule.filterOperators, {startsWith: 'contains'});
}
...
render() {
return (<div className='control-pane'>
<div className='control-section row'>
<div style={{ padding: '14px 0' }}>
<div className="select-wrap">
<DropDownListComponent id="ddlelement" dataSource={this.filData} fields={this.fields} change={this.onChange.bind(this)} placeholder="Select category to filter" width="200px"/>
</div>
</div>
<GridComponent dataSource={categoryData} allowPaging={true} dataBound={ this.dataBound.bind(this)} ref={grid => this.gridInstance = grid} pageSettings={{ pageSize: 10, pageCount: 5 }} allowFiltering={true}>
...
<Inject services={[Filter, Page]}/>
</GridComponent>
</div>
</div>);
}
}
render(<Filtering />, document.getElementById('sample')); |
Please find the sample in below link.
Please get back to us if you need further assistance.
Regards,
J Mohammed Farook.
JJ
Jayabharathi J
Syncfusion Team
October 16, 2018 04:20 AM UTC
MF
Mohammed Farook J
Syncfusion Team
October 16, 2018 06:00 AM UTC
Hi Társis,
Thanks for your update.
We are happy to hear that your problem has been resolved.
Please get back to us if you need further assistance from us.
Regards,
J Mohammed Farook
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
TÁ Társis
- Oct 12, 2018 04:24 PM UTC
- Oct 16, 2018 06:00 AM UTC