How to add more items from server side, on scroll of list

Team,

I have requirement where on scrolling the list, more items need to be shown.
I referred this document where scroll event is binded when pop up is opened: 

The issue here is, a new handler is getting binded each time pop up is opened and closed, hence on scrolling multiple times items are fetched and added into list.
How to bind just once? or remove the handler once pop up is closed?

Thanks
Tuariq


2 Replies 1 reply marked as answer

TU Tuariq September 22, 2020 01:22 PM UTC

Attaching post link: https://www.syncfusion.com/forums/156344/dropdown-with-huge-data


SP Sureshkumar P Syncfusion Team September 23, 2020 07:47 AM UTC

Hi Tuariq, 
 
Greetings from Syncfusion support. 
 
We can unbind the scoll event when close the popup in dropdownlist component using close event. 
 
Please refer the code example here: 
[sample.html] 
 
<ejs-dropdownlist id='remoteData' #remote [dataSource]='data' [fields]='remoteFields' [query]='query' [placeholder]='remoteWaterMark' (open)="onOpen($event)" (close)="onClose($event)"></ejs-dropdownlist> 
 
 
[sample.ts] 
 
public onClose() { 
    let listElement: HTMLElement = (this.dropdownObj as any).list; 
    listElement.removeEventListener('scroll', () => { }); 
  } 
 
 
We have modified the sample. please find the sample here: https://stackblitz.com/edit/angular-guucqq-rvoexd?file=app.component.ts  
 
Regards,
Sureshkumar P
 


Marked as answer
Loader.
Up arrow icon