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
close icon

Support search as you type in the fields dropdown

Is it possible to support search as you type in the fields dropdown?
Or even better, is it possible to use a custom component to display the fields?

1 Reply

SP Sangeetha Priya Murugan Syncfusion Team November 19, 2019 10:31 AM UTC

Hi omPrakash, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported requirement and we would like to let you know that, your requirement can be achievable in our QueryBuilder using allowFiltering property and filtering event.  For your conevenience, we have prepared the sample that binds the filtering event for dropdownlists in the querybuilder created and change event as like as below code example. 
 
Code Example: 
 
    createdControl() { 
    if (Browser.isDevice) { 
        this.qbObj.summaryView = true; 
    } 
    this.bindEvent(); 
} 
        // bind filtering event for dropdownlist 
bindEvent(){ 
let ddlColl = document.querySelectorAll('.e-dropdownlist'); 
for (let i = 0; i < ddlColl.length; i++) { 
    let ddl = getComponent(ddlColl[i], "dropdownlist"); 
    ddl.index = -1; 
    ddl.dataBind(); 
    if(ddlColl[i].id.indexOf("operatorkey") < 0){ 
    ddl.filtering = this.onFiltering; 
    ddl.allowFiltering = true; 
    } 
} 
} 
onChange(args) { 
if(args.type ==="insertRule") 
this.bindEvent(); 
} 
onFiltering(e) { 
    let query = new Query(); 
    //frame the query based on search string with filter type. 
    let qryBldrObj =getComponent(document.querySelector('#querybuilder'), 'query-builder'); 
    query = (e.text !== '') ? query.where('label', 'startswith', e.text, true) : query; 
    //pass the filter data source, filter query to updateData method. 
    e.updateData(qryBldrObj.columns , query); 
} 
 
        <QueryBuilderComponent id='querybuilder' width='70%' dataSource={employeeData} columns={this.columnData} created={this.createdControl.bind(this)} change={this.onChange.bind(this)} ref={(scope) => { this.qbObj = scope; }}> 
        </QueryBuilderComponent> 
 
 
Could you please check the above sample and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


Loader.
Live Chat Icon For mobile
Up arrow icon