cancel
Showing results for 
Search instead for 
Did you mean: 

Determine active view and fire plug from controller

Former Member
0 Kudos

I have a WebDynpro component with View A and View B.

There are inbound and outbound plugs between View A and View B

Is it possible that whenever a particular method in the component controller of this WebDynpro Component is invoked, it would check if View A or View B is currently active, and if View B is active, it would fire the plug in view B to navigate back to view A.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Solved it myself.

Former Member
0 Kudos

hi ,

Could you please elaborate the purose...might be we can get more insight.

Thanks,

Nandini

Former Member
0 Kudos

This Webdynpro Component is running in the right pane of a view container, and is invoked (via a startup plug in the Interface view) by another (2nd) component running parallally in the left container. The Interface view of this componet then calls a function in its Component controller.

But the problem is, that whenever the startup plug of this component is fired, and the corresponding methodn in its Component controller is invoked, it just shows whatever view (A or B) that was last navigated.

I need to make sure that whenever the in-question function is called, it should determine which view (A or B) is active and accordingly trigger an event which can be subscribed by hook method in View B which would then fire the plug to navigate to View A.

Former Member
0 Kudos

hi

Create an attribute of string type in component controller and map it to both the views

In wdinit of view set the value of above attribute(any value like view1active) for activeness of the view and in wdexit set its value(for ex view 1 inactive ) for in-activeness

Do this for both the views .

As the attribute is mapped you can check its value at any stage.

Hope it may work.

Regards

Suresh

Former Member
0 Kudos

Hi Subhabrata,

Two ways you can proceed about this,

1. As Suresh suggested you can follow and check the active view the concept is same you can check the parameter and determine the active view and go ahead with the navigation. However I wouldn't recommend you to create and map the attribute as per best practice you should avoid to create unnecessary attributes and map because context itself is a heavy object. Instead try to pass it as method parameter which will overall increase the application performance a bit.

2. You can control the life span of the views by going to view's Miscellaneous property and changing the lifespan to when visible. It will again serve two purpose 1st it will reduce the unnecessary load on application performance when that view is not visible and 2nd the instance of view will be available only when its visible so will solve the problem.

Hope it helps.

Regards

Jeetendra

Former Member
0 Kudos

Hi Subhabrata,

Are you calling that particular method of component controller from custom method of view or from hook method? If you are calling it from custom method its possible to pass a parameter of type string and check that string lets say "view1" or "view2"

and according to matched string you can determine the view and fire the plug accordingly.

Regards

Jeetendra