cancel
Showing results for 
Search instead for 
Did you mean: 

Calling View Controller from Component Controller ?

Former Member
0 Kudos

Hi Gurus

I want to know wheather it is possible to call View Controller from Component Controller. If yes please tell me how.

Please help me out with this problem..

Thank you

Regards

Chakradhar Reddy

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

HI

it will be very complex and not recommended thing to call view controller in the component controller.

we can use window controller in the component controller. but for using view controller, you need to pass the view controller's

instance to the component controller through context and then also i am not sure you will be able to call the methods.

so you can look for some alternative approach. wht is your requirement by the way

regards,

sarbjeet

Former Member
0 Kudos

Hi...

Thank you very much. I just wanted to know about it.thats it....

Answers (4)

Answers (4)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm going to add my voice to the advice you have already received here. If you feel the desire to call a view contorller from the component controller, then this is a sign that you have a design problem in your component. Although there are technical ways to do this, it should never be done as it is a very bad design approach. Nor with good component structuring should you ever really even be tempted to do so.

Former Member
0 Kudos

Hi Chakradhar ,

I dont think its possible as recommended by the experts also. You view is visible in the output where you have the layout. From view controller code wizrd you will for two options:-

1. Method call in curren controller . ( Methods in same view)

2. Method call in used controller. ( Methods in used components , the component you have declare in properties ) :- here you declare the component controller by which you can access the method of compcontroller.

The same scenario is also for the node. When you make a node in component controller it's visible to viewcontroller but the reverse is not true.

So its like concept of local and global variable.

Global variable are accessible to local variable but local variable are not accessible outside it.

Thanks & Regards,

Monishankar C

Former Member
0 Kudos

i think sarbeet said it already.

ViewController is private visibility and component controller is public visibility.

What ever the method you want to call from View, you can refactor to the component controller and call it from there.This is the good practice.

Former Member
0 Kudos

Hi ,

Try to store the view's controller's reference(type if_wd_view_controller) as a attribute of component controller in the WDDOINIT or WDMODIFY method of view and use it to call methods of the view.

Thanks,

Aditya.