on 06-19-2008 2:09 PM
Hi,
is it programatically possible to fire an event (not an action)? I want to simulate an user click.
Best regards
Roman
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
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.
Hi,
If you could explain your use case it would be of help.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.