Hello,

I wanted to be able to trigger or "open" a dropdown widget not by clicking on it but from another source, in this case, it would be an Icon with an OnClick associated. I tried several ways to manipulate the dropdown using Javascript but could not get it to work.

The idea is to have the native behavior of the dropdown on mobile devices (with the Options Content set to Text Only) shown when clicking on another element of the page, while the actual dropdown widget associated with providing the list is hidden from view.

I could not get to work simply by trying to manipulate the widget so I was thinking:

  • Is it it possible to achieve this using Javascript on the widget?
  • Do I need to invoke the Cordova native event and provide the list of options separately and bypass the need for the dropdown widget?

The images provide the desired visual output (Icon to be clicked highlighted in black, dropdown in red) aswell as the action flow with the Javascript mentioned above.

Hi Gonçalo,

I'm not sure that I completely understood your requirement, if the below mentioned sample implementation is what you are looking for, then it's easy.

Check this: Sample App Screen

1) Wrap the Dropdown widget inside an IF widget

2) Toggle the IF widget boolean variable on every Filter icon click


Objective: If you are trying to open/show the Dropdown widget select options programmatically, I think it's not easy and somewhat not possible.

Refer this: https://stackoverflow.com/questions/430237/is-it-possible-to-use-js-to-open-an-html-select-to-show-its-option-list


Hope this helps you!


Regards,

Benjith Sam

Hello Benjamin,

Thank you for the quick and insightful answer.

Unfortunately, the intended behavior is the second one you mentioned, aka. to show the Dropdown Options programmatically, which seems to be a dead-end. At least in a reliable and trustworthy manner.

Thanks anyway!

Cheers,

Gonçalo Pessanha

Gonçalo Pessanha wrote:

Hello Benjamin,

Thank you for the quick and insightful answer.

Unfortunately, the intended behavior is the second one you mentioned, aka. to show the Dropdown Options programmatically, which seems to be a dead-end. At least in a reliable and trustworthy manner.

Thanks anyway!

Cheers,

Gonçalo Pessanha

You are welcome, Gonçalo Pessanha :)


Regards,

Benjith Sam