cancel
Showing results for 
Search instead for 
Did you mean: 

call view method from componentcontroller method

Former Member
0 Kudos

hello,

how can i call a view method from componentcontroller method?

thanks

marcus

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello Marcus Ventur,

As you already know you cannot call a view method from component controller(CC).

There are only two possibilities:

1)Write the code into CC method which you wanted to access from both the view level and CC level.

Then you can access this method from both View and Component Controller.

2)If this is not necessary to access through interface method to the component controller,

May be you can try working with firing an event from the view level(Reused Comopnent) and catch it at Main WD component controller/View(as you said,u came from other WD component) level.

Thanks,

Bharath.K

Edited by: Bharath Komarapalem on Dec 10, 2008 5:40 PM

Former Member
0 Kudos

yes, but its not so easy. it is not my half-baked application.

now i made a boolean public context attribute.

if i came from the interface method, the context attribute EQ 'X'.

In the modify of the view i check the context attribute. if X -> call method, if not, do nothing.

so its not fine but it works.

thanks

Former Member
0 Kudos

yes, i know. but i came from an other webdynpro with an interface method to the component controller. here i want call an method from the view.

and if i have an instance of the view in the componentcontroller?

bg

marcus

Former Member
0 Kudos

Hi,

The component which u want to use. In that component also make the methods in component controller only. Then only you would be able to use that methods in any component.

Regards,

Rohit

Former Member
0 Kudos

Hi Marcus,

As you said instance of view is already there when you are creating component controller's instance. So you work is done. You have to have event handlling mechanism.

1. Create an event in your componentcontroller (Used component).

2. Have a interface method in the same component controller. Now from you component you can call this method right.

3. In the implementation of this interface method fire the event which you have created in step 1.

4. Write eventhandler for this compnent's event in the view where actuall method is.

So the moment u will call interface method of component it will fire component's event and it turn this event will be caught by the event hadler u have written in view.

5. Now in implementation of this view's eventhandler call the view's required method.

And job is done.

Only thing event hadler of view will work only in case view is initialized in memory. As you said you have the view instance so no probs..

Ask in case of any doubt.

Regards,

Neha Modi

Former Member
0 Kudos

Hi,

You can not call view method from the component controller.

Better You write that method in the component controller only. By this You can use this method in component controller as well in any view also.

Regards,

Rohit