Skip to Content
avatar image
Former Member

Component lifecycle

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 21, 2010 at 01:19 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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