EJ2 > MVC > Dropdownlist - How can we achieve virtual scrolling in ej2 mvc dropdownlist

I need virtual scrolling feature in ej2 mvc dropdownlist but there is no clue in documentation. Can you guys please let me know how can i achieve this feature, I have more than thousand records to bind in dropdownlist and without virtual scrolling feature dropdown gets very slow.

1 Reply 1 reply marked as answer

BC Berly Christopher Syncfusion Team June 26, 2020 02:13 PM UTC

Hi Abdul, 
  
Greetings from Syncfusion support.  
  
Currently there is no virtual scrolling support has been provided for DropDownList component. But we have considered this as a feature at our end. This support will be included in any one of our upcoming releases. You can track the status of this support from the below feedback link. 
  
  
We can achieve this support by using the below work around solution in the DropDownList component. 
  
<div id='remote-data' class='col-lg-6' style='padding-top:15px'> 
    <div class='content'> 
        <ejs-dropdownlist id="customers" placeholder="Select a customer" query="new ej.data.Query().select(['CustomerID'])" open="onOpen"> 
            <e-dropdownlist-fields value="CustomerID"></e-dropdownlist-fields> 
            <e-data-manager url="https://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Orders/" adaptor="ODataAdaptor" crossDomain="true"></e-data-manager> 
        </ejs-dropdownlist> 
    </div> 
</div> 
 
<script> 
    var isInitial = false; 
    function onOpen(args) { 
        if (!this.isInitial) { 
            var start = 11; 
            var end = 20; 
            var instance = document.getElementById("customers").ej2_instances[0]; 
            var listElement = instance.popupObj.element.firstChild; 
            listElement.addEventListener('scroll', () => { 
                if ((listElement.scrollTop + listElement.offsetHeight >= listElement.scrollHeight)) { 
                    var filterQuery = this.query.clone(); 
                    this.dataSource.executeQuery(filterQuery.range(start, end)).then((event) => { 
                        start = end; 
                        end += 5; 
                        instance.addItem(event.result); 
                    }).catch((e) => { 
                    }); 
                } 
            }) 
        } 
    }  
</script> 
 
 
  
Please find the sample from the below link. 
  
Please refer the documentation to know more about virtual scrolling in DropDownList. 
  
Regards, 
Berly B.C 


Marked as answer
Loader.
Up arrow icon