Retrieve Event.target in Nanoflows, or triggering element? - Mendix Forum

Retrieve Event.target in Nanoflows, or triggering element?

2

Dear all,

When executing a JavaScript Action in a Nanoflow, it is often handy to know what element triggered the action. E.g., say a button with id=”button01” triggers that flow, and I want to encapsulate that button in an extra container, with class, with styling, etc. Now I will have to do a hard-coded search on the DOM, using the id. That doesn't make it very flexible, nor does it make the action quick, as the entire DOM needs to be searched, while we should already have this information available.

In vanilla JavaScript, we normally have the option to call on event.target; this returns the triggering element, so we can perform actions on it. E.g., we can retrieve the parent, add that div with the class, and put it back in the DOM.

I propose we have an “NanoflowEventTrigger” available as a standard parameter in every JavaScript action that is triggered from a Nanoflow. This will greatly increase flexibility and speed of most of the JavaScript actions needed.

Best regards,

Wouter Penris

asked
0 answers