cancel
Showing results for 
Search instead for 
Did you mean: 

Regeneration of dynamic ui elements

Former Member
0 Kudos

Hello to all!!! could you help me with this problem? thanks!

I have two views. In the first view the user has to select some items. In the second view, the application has to give an overview of the items selected.

Since the number of selected items is not known at design time, the overview has to be generated dynamically.

The problem is that if I go to the second view and come back to the first and select other items, then the view is not being regenerated.

Some details of my code are the following:

If the first view is called View1 and the second View2:

- In the wdModifyView, when firstTime, I generate the dynamic elements: no problem

- In the wdModifyView of View2. when not firstTime and the user have exited the view (through wdDoExit) I regenerate again the dynamic elements: I'm not sure when this method is executed

-In wdDoExit of View2, I set an attribute 'exited' to detect when the user exits the view

The code I use is as follows:

-


In View2

public static void wdDoModifyView(IPrivateVerificacionSolicitud wdThis, IPrivateVerificacionSolicitud.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime){

//Crea nodo dinamico

IWDNodeInfo node = wdContext.getNodeInfo().addChild( "DynamicNode", null, true, true, false, false, false, true, null, null, null);

generarDetallesSolicitudUI(wdThis, wdContext, view);

}

if (!firstTime && wdContext.currentContextElement().getVerificacionSolicitudSalio() ) {

view.resetView();

wdContext.getContext().reset();

//Crea nodo dinamico

IWDNodeInfo node = wdContext.getNodeInfo().addChild(

"DynamicNode", null, true, true, false, false, false, true, null, null, null);

generarDetallesSolicitudUI(wdThis, wdContext, view);

}

//@@end

}

public void wdDoExit()

{

//@@begin wdDoExit()

wdContext.currentContextElement().setVerificacionSolicitudSalio(true);

//@@end

}

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.currentContextElement().setVerificacionSolicitudSalio(false);

//@@end

}

the method generarDetallesSolicitudUI(wdThis, wdContext, view); is the one that generates the dynamic ui elements

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Add a boolean attribute to the context of view #2. In the outbound plug of view #1, set this flag if the selection has changed and view #2 has to be updated.

In wdDoModifyView() of view #2, read the flag, rebuild the view (part) and reset the flag.

Don't create context attributes and don't reset the context inside wdDoModifyView().

Instead of resetting the complete view it might be sufficient to clear the root container using destroyAllChildren().

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Yeah!!! it was the problem... the setting of the flag!! it wasn't good!

Thanks a lot for the answer