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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Combobox virtual scroll & searching

Thread ID:

Created:

Updated:

Platform:

Replies:

144778 May 22,2019 07:19 AM UTC May 22,2019 11:39 AM UTC JavaScript - EJ 2 1
loading
Tags: ComboBox
BERNARD Ludovic
Asked On May 22, 2019 07:19 AM UTC

Hello,

I want to use the ej.dropdowns.ComboBox (javascript es5) and I am facing 2 issues.

First the I can't find the virtual scrolling inside the API Reference so above 1000 items inside the list it becomes pretty slow.

Second I want to be able to filter the list inside with what I'm typing :

ex: [ 'one', 'two', 'three' ] when type 'e' filter > ['one', 'three']
instead it shows nothing because the filter is on the first letters

Have you ever encounter these issues?
Do you have any options to make it work?

Thank you

Prince Oliver [Syncfusion]
Replied On May 22, 2019 11:39 AM UTC

Hello Bernard, 

Greetings from Syncfusion support. 

Query 1: First the I can't find the virtual scrolling inside the API Reference so above 1000 items inside the list it becomes pretty slow. 

Currently virtual scrolling is not supported via API. But we can achieve the functionality by manually performing the virtual scroll operation using scroll event handler bound through the open event. Kindly refer to the following code snippet. 

function onOpen(args) { 
    if (!isInitial) { 
        var start = 11; 
        var end = 20; 
        var element = this.element.ej2_instances[0]; 
        var listElement = this.element.ej2_instances[0].list; 
        listElement.addEventListener('scroll', function () { 
            if ((listElement.scrollTop + listElement.offsetHeight >= listElement.scrollHeight)) { 
                let filterQuery = query.clone(); 
                data.executeQuery(filterQuery.range(start, end)).then((event) => { 
                    start = end; 
                    end += 5; 
                    element.addItem(event.result); 
                }).catch(function (e) { 
                }); 
            } 
        }) 
    } 
} 

Query 2: Second I want to be able to filter the list inside with what I'm typing : ex: [ 'one', 'two', 'three' ] when type 'e' filter > ['one', 'three'] instead it shows nothing because the filter is on the first letters 

We have provided option in the filtering event to customize the filter type in the ComboBox. To use you need to enable filtering using allowFiltering API. Kindly refer to the following code snippet. 

function OnFiltering(e) {  
    query = new ej.data.Query().from('Customers').select(['ContactName', 'CustomerID']);  
    query = (e.text != "") ? query.where("ContactName", "contains", e.text, true) : query;  
    e.updateData(data, query);  
}  

We have attached an example for your reference, please find it in the following location: https://stackblitz.com/edit/w39uuc 

Let us know if you need any further assistance on this. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon