cancel
Showing results for 
Search instead for 
Did you mean: 

Component lifecycle

Former Member
0 Kudos

Hi,

I've made a component (a search constraint table editor) that, in its initialization when it's called, makes a copy of a tree of the context of the caller based on a IWDNode that is passed as a parameter.

This component is made generic and abstract so that the table editor could be called from various point in the caller web dynpro and for various elements.

The component view shows up as a popup window and is created when the caller invokes a specific method defined on the component's interface.

I need to find a way to destroy the component when the popup is dismissed so that when it's called again it starts anew.

The problem is that if I invoke the popup again, the component instance already holds the copied context and so the initialization code raises an exception.

Thank you,

Pietro

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

Hi,

I think you can add a method in the interface controller of the reused component to do the initialization job explicitly.

so you can reinitialize the component whenever you want.

another option is you set the component usage life cycle to "manual".

you will use code to create the instance of the reused component and to destroy the instance.

if(	!wdThis.wdGet*****ComponentUsage().hasActiveComponent()){
		
		wdThis.wdGet******ComponentUsage().createComponent();
		
	}

if(wdThis.wdGet*******ComponentUsage().hasActiveComponent()){
			
			wdThis.wdGet********ComponentUsage().deleteComponent();
		}

Best regards,

John

Former Member
0 Kudos

Thank you John,

it was sufficient to put this before the PopUp invocation:

if (wdThis.wdGetAdvancedSearchComponentUsage().hasActiveComponent())
	wdThis.wdGetAdvancedSearchComponentUsage().deleteComponent();

Leaving the component creation OnDemand automatically recreates the component, so these two lines only do the trick!

See you,

Pietro

Answers (0)