cancel
Showing results for 
Search instead for 
Did you mean: 

Not receiving controller event in listener view

Former Member
0 Kudos

Hi,

I was trying to implement following the How to Navigate Inside Web Dynpro Component Interface Views paper. In my controller i created an event and a method which fires the event. I call the fireEvent method from a view through the controller. It comes into the method.

I now declared a event handler in another view which has a reference to the controller. In the wizard i can choose the controller and the event to which the listener should listen. The only problem is that when i fire the event, it is not caught by my listener....(the navdispatcher view)

I have used this contruction before which worked but i cannot figure out why it's not working with this one....anyone have any ideas?

Much thanks,

Hugo Hendriks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Hugo,

Where are you firing the event from? Is your view firing the event? Can you describe the flow a bit?

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

Im calling the method from an view. Like this:

wdThis.wdGetEWLAppController().fireExecuteTaskEvent(formAttribute);

The controller should then fire this event to all subscribed listeners. I subscribered a NavDispatcherView to handle this event and load the appropriate view.

regards,

Hugo

Former Member
0 Kudos

I just read something in the paper which states:

It must always be active or displayed within the UICompA window

Does this mean that the view which fires the event has to be visible? Because in my app, the view which triggers the event is visible and not the view which receives the event and has to relay it. Is that the problem maybe?

Former Member
0 Kudos

Hugo,

View may not fire events. View may call method on other controller (component / custom) and this controller fires event.

You are absolutely right: in WD only instantiated controllers receives the event, event itself does not cause controller instantiation.

The only controller that is always instantiated is component controller.

Custom controllers instantiated on demand when their context is accessed or user-defined method called.

As far as view may not have externally visible context nodes and methods (you may not add view controller as required to other one and use nodes/methods of view), the only time when view is instantiated is when it get visible for first time.

To solve your problem, try the following:

1. Save event parameters to component controller context node element before firing event.

2. Create mapped node in target view and set node from controller as source.

3. In wdDoInit of target view insert the following code:


wdThis.<eventHandlerName>(
null, //no wdEvent
wdConext.current<NameOfMappedNode>Element().get<NameOfParamA>(),
wdConext.current<NameOfMappedNode>Element().get<NameOfParamB>(),
);

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Valery,

Im getting confused. You say that in WD only instantiated controllers receive event, but i have a piece of code in which i create a datepopup window. When the user has selected a date, the view calls the fireEvent method of the controller. The view which openened the popupwindow is registered as a listener and receives the event when a date is chosen and closes the popup window. In this situation, the view is also registered as a listener so this is possible.

I want to use the same construction now. A view calls a method of the component controller which fires an event. I registered a navdispatcherView as listener but it doesnt receive the event. The only difference with the date popup is that the navdispatcherView isnt visible/active when the event from the component is fired.

The sentence: "As far as view may not have externally visible context nodes and methods (you may not add view controller as required to other one and use nodes/methods of view), the only time when view is instantiated is when it get visible for first time." is really clear to me. Do you mean as long as the view hasnt been visible, it isnt instantiated and thus cannot receive events?

Much thanks,

Hugo

Former Member
0 Kudos

Hugo,

<i>Do you mean as long as the view hasnt been visible, it isnt instantiated and thus cannot receive events</i>

Yes!

What I mean in short words: if view controller is event recepient, it must be visible prior event has been sent; otherwise event does not reach view.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Valery,

Aaaah, ok..thx.

Sorry for the long discussion but im still quite new to WD and trying to figure out still al the ins and outs.

Much thanks,

Hugo

Former Member
0 Kudos

I am having similar problems.

For me View A embeds View B and C. But when view B fires an event, only view A seems to be able to recevive it. Try as i might view C just does not seem to pick up the event even though it is already visible.

Any reason why? Pls help