How to work with the Dropdown widget (Custom) using JavaScript?
Application Type
Reactive

Hi,

In a Reactive application I have a Dropdown widget with the options property set to Custom (instead of Text).


That makes it render a Dropdown that is not the native select element of the browser, but some set of divs, JavaScript and CSS that emulate a Dropdown.

I'm trying to find a way to:

- get the list of options from my Dropdown;

- get the selected value of the Dropdown;

- set the selected value of the Dropdown.

All of the above using JavaScript.

Does anyone know how to do this?


Thank you

Hi Leonardo,


Why don't you create a local list with your options and use it as a "normal" dropdown? You can initialize the list in the "OnInitialize" event of the screen. I think it would be much easier to implement/maintain your code. And if you want to perform actions in this list using JavaScript you can create client actions and call them from the JavaScript.


Regards

Victor, the reason I'm trying to find a way to interact with it using javascript is because of test automation. There is a testing tool that is being used, that needs to interact with the dropdown (read the options, set the value...). That's why I wanted to know if such methods are available and how to do... Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.