#104405
Andrea Durando
Participant

Hi Ivanpeevski, that’s clear,
but, apologise me I think I didn’t explain my trouble well,
my question is how can I trigger the callback function to have pre-populate the dropdown elements, and also it should be used when I go to modify it.
I try to move it in ngAfterViewInit as you suggest

`ngAfterViewInit(): void { this.combobox.dataSource = (query: string, callback: (val:ComboType[])=>void): void => {
this.combobox.displayLoadingIndicator = true;
if(this.inputParams.dataSource) {
this.inputParams.dataSource.filter((item) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const valLabel: any = item[this.inputParams.labelField as keyof typeof item];
return valLabel.includes(query);
});
}
else {
let queryString: HttpParams = new HttpParams();
if(query.length > 0) {
queryString = queryString.append(“filter”, ${this.inputParams.labelField}@=${query})
}
this.sysService.getComboBox<ComboType[]>(/${this.inputParams.comboUrl}, queryString).subscribe((response: HttpResponse<ComboType[]>) => {
this.combobox.displayLoadingIndicator = false;
callback((response.body ?? []));
})
}
}
}

But do not fix my issue,