cancel
Showing results for 
Search instead for 
Did you mean: 

Control lifetime of view

former_member211591
Contributor
0 Kudos

Hi Experts,

In my scenario I've got following navigations:

ViewMain <---> view1 <---> view2 <---> view3.

I am able to navigate between the views back and forth. The views are not destroyed since Lifetime is set to "Framework Controlled".

But I need to initialize view1, view2 and view3 when navigating between ViewMain <--> view1 (both directions) and while navigating between view1 <---> view2 <---> view3 they have to be alive.

But if I set the Lifetime of view 1 to "when visible", it is also destroyed when  navigating between view1 <---> view2 <---> view3.

How can I explicitly destroy view1, view2 and view3 when navigating between ViewMain <---> view1?

Setting Lifetime  to "when visible" does not help me in this case.

Thanks for your answers.

Ismail

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It may not be exactly what you are looking for but you can take a different approach of initializing the views in Handler method for Inbound plugs.

If you have some piece of code written in WDDOINIT of these views, you can move this code to Inbound plug Handler methods.

Regards,

Rohit

former_member211591
Contributor
0 Kudos

Thats an idea, but anyway I need to destroy other views too.

So I need to find a way to identify "living" views during runtime (RR) and destroy them.

If I know how to destroy these instances, then you are right, I could do it within the plug handlers.

Does anybody know if it is possible and how I can destroy views? I need something like "DELETE_COMPONENT" for component usages, but for views.

amy_king
Active Contributor
0 Kudos

Hi Ismail,

Interface IF_WD_VIEW has two methods which may be of help...

  • IS_ALIVE Checks whether view controller has been cleared
  • RESET_VIEW Reinitializes the view

Cheers,

Amy

former_member211591
Contributor
0 Kudos

Hi Amy,

sounds good. I'll try that.

One more question regarding this.

Assume view1 is embedding view2. Is view2 also initialized when resetting view1?

What about active components used within the reseted view?

(Do I have to handle every instance used within the view separately?)

Best regards

ismail

amy_king
Active Contributor
0 Kudos

Hi Ismail,

Resetting view1 will not cause view2 to reset automatically. I'm curious if what you want is really to "destroy" the views or if what you want  is to re-initialize the context nodes used by the views?

If you really want the view "destroyed" and re-initialized as is done with a lifetime of "when visible", then reset_view will do this. However, if you're trying to "refresh" the view field values, what you want may instead be to invalidate the context node(s) used by the views with if_wd_context_node->invalidate. This method will cause the context node to be reinitialized and its supply function re-executed.

Cheers,

Amy