Manually invoke dropdown onchange event

Hello,
I have put some code in dropdown onchange event that must be executed also at page load.
Please tell me there is an easy way to force the onchange of all dropodown on page load.
Thanks,
Mario

There is no easy way to trigger the Change event of all dropdowns. You need to either use the reference field created for every dropdown e.g. this.dropdown0.change.next(value) or just execute the generated change event handler this.dropdown0Change(value).

I have tried to put both on page load and they are not working, what do I need to put in "value"?

I am suprised because I am used that on page load "onchange" should be called automatically. Or you should add another event to dropdown "onload" or similar.

They should both work. What does "not working" mean? Did you debug the code? Is it executed? Is there a JS error? It is impossible for me to guess why this isn't working without more details.

You put the value that is selected - usually what ValueProperty is set to. The change event cannot be invoked without arguments.

I am not aware of any UI component which fires its change event automatically without anybody changing its value. Here is the documentation of the change event of the <select> element which the DropDown emulates.

Ok I have debugged javascript.
BTW "value" is the "event" in the onXXX method.
Anyway in that code I do this.dropdown0.value but it happens that at onLoad the dropdown0.value is not yet initialized.
So I need to know where can I put some javascript function that is callable from onLoad and onChange to avoid code duplication.

You can add a function in the *.component.ts file then use Execute Code to invoke it. You have to cast this to any so you can invoke it.

(this as any).myFunction();