cancel
Showing results for 
Search instead for 
Did you mean: 

View raises Component Controller Event

Former Member
0 Kudos

Hello,

I defined an even onUpdate in the component controller. A custom controller subscribed to this event. For that I have a method handleOnUpdate in the custom controller. Now I want to raise this event in a view after pressing a submit button of this view.

How can I raise the event?

So data flow would be:

1. Button pressed in view

2. Raise event in component controller

3. Handle raised event in custom controller

Regards

Rene

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I solved it now.

I added the following method in comp. ctrl:

public void fireOnUpdate( )
  {
    //@@begin fireOnUpdate()
	wdThis.wdFireEventOnUpdate();
    //@@end
  }

This method is called by the view controller after a button action.

The custom controller subscribed to the comp. ctrl. event and is executed. I got some code in the custom controller and the custom controller raises an event by itself. To this event another view subscribed. The other view has to be active (default = true) else it wont handle the raised event.

Former Member
0 Kudos

Hi Rene,

Your scenario is like:

<b>View: OnSubmit -> Component Controller: OnUpdate -> Custom Controller:</b> <b>handleOnUpdate.</b>

For this, in the code for <u>OnSubmit</u> in your view, you need to add code as

wdThis.wdGet<ComponentControllerName>().onUpdate();

and in the <u>OnUpdate</u> method in Component Controller:

wdThis.wdGet<CustomContControllerName>().handleOnUpdate();

Also, you need to <b>add the Component Controller to your View</b>, using Properties Tab

<b>and Custom Controller in Component Controller</b>, using its properties tab.

Hope it helps.

Regards,

Alka.

Former Member
0 Kudos

I cant call wdThis.wdGet<ComponentControllerName>().onUpdate(), because this method does not exist.

I do really need to define the event handler in the component controller? Cant I define the event handler in the custom controller?

With your coding example I could solve the problem without using events. But I d prefer using events if possible.

Regards

Rene

Former Member
0 Kudos

chk it

Former Member
0 Kudos

Unfortunately the thread does not exactly apply to my problem. This one is related to a scenario with view controller and component controller. I got view controller (fire event), component controller (owner of event) and custom controller (subscriber of event).