cancel
Showing results for 
Search instead for 
Did you mean: 

need call a method of one iview from another iview

Former Member
0 Kudos

Hi,

There are 2 iviews in a component.

1) FirstView - contains abc() method & xyz() methods

2) SecondView (a popup) - asdf() method

i want to call abc() method from asdf() method. i.e. i want to call a method of the firstview from the secondview.

Note:

1) i couldn't able to copy the code of abc() method to component controller, as it has the code which uses (iview) local attributes (this can be done by context mapping) & main reason is from the method it calls the xyz() method of the same view (again i couldn't call a method of iview from component controller).

2) firstView contain 5 tabs, i want to be in the same tab from which secondview (popup) was called, if i use fire plugs between both view, the current tab will be chnaged (i suppose, not sure).

3) can we use event handlers, if yes how can we do that.

Please provide a better solution for calling a method of view from another view.

Thanks

Maha

Edited by: Maha Hussain on Jan 13, 2009 12:40 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can follow the steps mentioned above and for the second part of your problem if you want to be sure of moving back to the same tab from which the second view was called, you can use the following line of code:

wdContext.currentContextElement().setVa_SelectedTab("TabID");

//Replace the tabID with the code for what you have set before navigating from first view to second view.

May be it can help.

Regards.

Rajat

Former Member
0 Kudos

Hi Maha,

It is better to have such methods in the component controller to make it reusable and avoid writing same code again and again.

You can have that method in component controller and call that method on click on a button from Iview1 and can pass the parameters in the mthgod only.

for example.

Say Method abc() which is currently in Iview1 and you are passing values from context say aa bb cc to the method now what i am suggesting is

have that method abc(String aa, String bb, String cc) ;

and call it on click on button in Iview1 and pass the required parameters.

Hope this will help

Regards

Narendra

p330068
Active Contributor
0 Kudos

Hi Maha,

Create all the required method in the component controller. it is recommended to write business specific codes in the view controller. you can use the component controller methods in the views. Use context to the temporily store the parameter. and mapped to the component controlller context.

Hope this will helps you.

regards,

Arun