cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically fire an event

Former Member
0 Kudos

Hi,

is it programatically possible to fire an event (not an action)? I want to simulate an user click.

Best regards

Roman

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

It is very straightforward.

You should call the event, the same way you would call a fire-outbound-plug method.

The only difference is that, events are parameterised methods.

So, to call them programatically, pass null as the parameter.

So, your cod will be:

wdThis.onActiona_GO(null);

here, a_GO is an event that normally gets triggered onAction of a button. But using the above code, i call call this method anywhere i want, thereby programatically triggering the event.

I have used this several times, & it has worked beautifully.

Regards,

Hanoz

Former Member
0 Kudos

...

The only difference is that, events are parameterised methods.

...

No, there are other differences in specific ui elements, for example: DateNavigator oder Tabs...

Former Member
0 Kudos

Hi Roman,

Allow me to clarify my statement.

All your OnAction events, will be parameterised. It Will contain the IWDEvent as the parameter.

In contrast to this, your normal methods that you create, may or may not be parameterised.

Hence, in order to programatically call your Onaction methods, you code as if you are calling your regular methods, with the only change being that you will have to pass

null

for the IWDEvent parameter.

I hope i have made it clear about how to programatically trigger an OnAction Event.

Regards,

Hanoz

nikhil_bose
Active Contributor
0 Kudos

hi hanoz,

what if I have to popup file chooser of say FileUpLoad UI element programatically? I think Roman wants something similar.

any thoughts will greatly appreciated.

nikhil

Former Member
0 Kudos

A button click results just in the call of the associated action handler. So to "simulate" a button click, you have to call the action handler with the parameter values (if any) that would result from a real button click.

If you want to call the action handler from a different controller than the view controller, this is not possible. In that case you could either refactor the relevant code into some method of the component controller and call that method, or you could define a server-side event and fire that event which would be handled by the view controller and call the action handler.

Armin

Former Member
0 Kudos

For example in the UI element DateNavigator: if I call the action onDaySelect() the current selected (highlighted) day in the navigator is not changing as it would be, if a user clicks on a day in the DateNavigator. And it is not possible to change the current selection programatically. So I have to fire the associated event. In JavaScript I would write something like that:

getElemendById("DateNavigator").onClick(); How can I do that in WD, if it possible at all?

Former Member
0 Kudos

Hi,

Java script is not supported from webdynpro.

This is taken care by the framework.

Regards

Ayyapparaj

Former Member
0 Kudos

Java script is not supported from webdynpro.

This is taken care by the framework.

It's quite plain to me. Therefore I asked for solution in WD.

Former Member
0 Kudos

For the DateNavigator, you can bind the "firstSelectedDate" property to a context attribute and change the attribute value programmatically. Then the DateNavigator will also display the new selected date accordingly.

Armin

Former Member
0 Kudos

For the DateNavigator, you can bind the "firstSelectedDate" property to a context attribute and change the attribute value programmatically. Then the DateNavigator will also display the new selected date accordingly.

That will only change the current date not the current selected date, there are differences. The current date is highlighted with a red border and the current selected date gets another background color.

Former Member
0 Kudos

Are you sure?

Armin

Former Member
0 Kudos

Hi,

If you could explain your use case it would be of help.

Regards

Ayyapparaj

former_member751941
Active Contributor
0 Kudos

Hi Roman,

Yes it is possible.

Check this thread.

wdThis.wdFirePlug<Plugs name>();

Regards,

Mithu