I have a very large dataset and would like to have the autocomplete update as the user types, but I'm having trouble finding an example of how I could do that. All the examples seem to preload the data on startup.
Is their a way to retrieve partial datasets as the user is typing to show in the popup below without fetching the entire dataset?
public actionComplete(args){
let start: number = 7;
let end: number = 12;
let listElement: HTMLElement = (this.dropdownObj as any).list;
listElement.addEventListener('scroll', () => {
if ((listElement.scrollTop + listElement.offsetHeight >= listElement.scrollHeight)) {
let filterQuery = this.dropdownObj.query.clone();
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) => {
});
}
})
} |
Thanks Berly,
The one issue I have here is that it does not quite suite the use case. The user will typically not scroll when using an autocomplete, they will be typing and the list will be dynamically changing.
So what I really need is something like this:
1) User types (a)
Dropdown displays:
abacterial
abactinal
abaculus
abaculus
2) user types d (so ad is now in the textbox)
Dropdown displays
additive
addin
address
adductor
So the dropdown is changing as the user types.
is this type of scenario supprted?
Thanks for your help on this Ponmani, in the end i was able to accomplish what I was trying to do with the filtering and databound events of the grid.
----