I have a dropdown element that allows multiple selection, its data is populated with an api call that loads when the application starts, at the moment we open the dropdown we have all its data but, somehow it is taking around 2 to 3 seconds to open the list and show its options, is there a way to add a spinner that loads inside the dropdown while the data is being formed?
|
public onOpen(args) {
let start: number = 10;
let end: number = 15;
let listElement: HTMLElement = (this.dropdownObj as any).list;
listElement.addEventListener('scroll', () => {
if (
listElement.scrollTop + listElement.offsetHeight + 1 >=
listElement.scrollHeight
) {
let filterQuery = new Query();
new DataManager(this.data)
.executeQuery(filterQuery.range(start, end))
.then((event: any) => {
start = end;
end += 5;
this.dropdownObj.addItem(
event.result as {
[key: string]: Object;
}[]
);
})
.catch((e: Object) => {});
}
});
}
|
I have a similar case... but i create the multiselect from the TS file with a MultiselectModel... Is there a way to set the infinite scroll like in the above example?. Here is my code :
thank you waiting for the response :)
Thank you for the soon response, i already implemented the code, and it seems that works, but i got a trouble getting the list from the multiselect Object, when i try to get the list from the multiselect Object, i get a div instead of a list, and the event scroll doesnt trigger.