Hello OutSystems community
Has anyone an idea how I can set the focus to the search field of the Dropdown search widget?
It would be easy to do it by JS, but you cannot select the Id of the "vscomp-dropdown-container" in OutSystems. And by default the container is not expanded.
The goal is to set the focus on this dropdown when a popup is opened.
After selecting a value the focus should be again on the search field.
Best regards
Dimitri
Hi Dimitri Miller,
You can try to do this on click function of drop down add class by js to the element which concluded border and set focus property.
Addclass and of change you can removeclass.
Hope this helps
Thanks
Prince
Hello,
You can do it with a bit of javascript. In the action where you're toggling the variable that shows the popup, run the following javascript code:
window.setTimeout(() => { OutSystems.OSUI.Patterns.DropdownAPI.Open($parameters.DropdownId); }, 200);
Notice that the call needs to be inside a "setTimeout", to give the popup some time to open before trying to also open the dropdown. You might have to tweak that 200 value according to your preferences.
If you want to once again open and focus the dropdown after a value is selected, you can run that exact same javascript in the dropdown's "OnChanged" event.