cancel
Showing results for 
Search instead for 
Did you mean: 

How call a view method from a customcontroller?

Former Member
0 Kudos

Hi everybody,

how is ist possible to call a method within a view from a customcontroller.

I have two views and a customcontroller between them. A method in view A should trigger a method in view B through the customcontroller.

regards,

Sid

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You cannot do that and that's ok. But you can register the view controller to some event of the custom controller and fire an event instead.

Armin

Former Member
0 Kudos

Hi Armin,

could you please give me an example on how i can do that?

Thanks in advance!

Sid

Former Member
0 Kudos

Use the controller editor of the custom controller to create a new event, maybe with parameters.

Declare the custom controller as "required" from the view controller (if not done already), create a new method in the view controller as event handler for that event.

Then the NWDS will generate a method in the custom controller to fire the event and a method in the view controller to handle it.

Armin

Former Member
0 Kudos

Hello Armin,

I also tried to do the same thing....i followed the steps as you mentioned and the NWDS generated method for the event in the View Controller but not in the Custom Controller....so how can i call the method in the view controller....?

Regards,

Shikhil

Former Member
0 Kudos

The view controller event handler is called by the framework whenever the custom controller fires the event.

Armin

Former Member
0 Kudos

Armin,

Thanks for the reply...So how do i fire the event from the custom controller....?

Regards,

Shikhil

Former Member
0 Kudos

Hi Shikhil,

you can fire it like this:

wdThis.wdFireEvent<yourEventName>(your Parameter);

regards,

Sid

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

I don't think so you can call view methods from custom controller....as all the methods in it are by default Private ....and it does not agree with the MVC Architecture which Webdynpro follows....

Regards,

Shikhil

Former Member
0 Kudos

Hi,

make the context mapping b/w A view and B view to the custom controller, after that only we can call the methods available under the custom controller, if you want to use the same method in the both the views you need to write under the custom controller and call the method from your view controller.

to call method from cutom controller for view:

wdThis.wdget<customcontroller name>controller().<method name>();

Cheers,

Apparao