345
Views
4
Comments
Solved
How to trigger an action when dropdown is clicked and the option is displayed

Is there any way to detect when dropdown is clicked and the options are displayed?

I want to create a process that changes an option in a pulldown depending on the result of another pulldown selection.
However, the following conditions apply
 ・Placed in a Table that allows users to add rows (rows : no limit)
 ・Dropdowns that are conditions and dropdowns that you want to change options are placed one per line
Because of these conditions, it is not possible to respond by passing variables to Aggregate.
Therefore, I would came up with the following process. 

 (1) Change the option to "Cunstom".
 (2) Define a class with a conditional value for each option.
 (3) When the dropdown that becomes a condition is changed, control the display display by the class set in (2).

However, in the case of "Custom," the options are created at the time the dropdown is opened, so it is not possible to show or hide the options at the time the conditional dropdown is changed.
So I would like to know how to detect the event "dropdown is opened and options are displayed".
Or if there is another better way, please let me know.


*I am creating an application with Reactive Web

2024-12-10 04-40-04
Gitansh Anand
Solution

Hi Sato, If you are setting OnFocus on Dropdown B then don't use SetFocus in OnChange of Dropdown A, you should use it in OnChange of Dropdown B to set focus on something else and not on Dropdown B.

Also, what you are trying to achieve could be done in other ways. I am adding an OML with two screens using two slightly different methods; please look and see if it works for you.

Thanks
Gitansh Anand

Test.oml
2024-12-10 04-40-04
Gitansh Anand

Hi Sato, I would suggest you add a handler for the "OnFocus" event of your dropdown, which will be triggered when the dropdown is opened and the options are displayed, but you should also use Outsystems "SetFocus" client action from the "OutsystemsUI" module to set the focus to some other element in the "OnChange" event of the dropdown, because when the user selects an option from the dropdown, the focus remains on the dropdown, and because of that, if the user clicks on the dropdown again, the "OnFocus" event will not be triggered but the options will be displayed.

UserImage.jpg
Sato Rihwa

 Hi Gitansh, thanks for the advice! I immediately tried to follow the advice, but the onFocus event was not triggered. I have taken the following action. Is there something wrong with the procedure?*Changing the A dropdown will change the choices in the B dropdown depending on the value of A.

1.Add onChange action to A2.Call the SetFocus client action in the onChange action of A and pass the widgetId of B as an argument3.Add B onFocus action and implement the processing I want to do

●Screen and drop-down images


●DropdownA onchange action

●DropDownB Settings

2024-12-10 04-40-04
Gitansh Anand
Solution

Hi Sato, If you are setting OnFocus on Dropdown B then don't use SetFocus in OnChange of Dropdown A, you should use it in OnChange of Dropdown B to set focus on something else and not on Dropdown B.

Also, what you are trying to achieve could be done in other ways. I am adding an OML with two screens using two slightly different methods; please look and see if it works for you.

Thanks
Gitansh Anand

Test.oml
UserImage.jpg
Sato Rihwa
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.