cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh a view after an action

Former Member
0 Kudos

hi,

I made a view with both a table and a form, i use the form to fill the table besides but i got a problem the table is not refreshing after clicking to the action button.

Is there a way to make a refresh ?

Regards,

FM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You don't need to refresh explicitely. Can you post your code?

Armin

Former Member
0 Kudos

// -

-


// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// -

-


package com.sap;

//

// IMPORTANT NOTE:

// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED

// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN

// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateATRView).

// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY

// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS

// OF IMPORT STATEMENTS.

//

//@@begin imports

import com.sap.atr2model.Request_ATR2ViDocument_delCand;

import com.sap.atr2model.Request_ATR2ViDocument_getAllCand;

import com.sap.atr2model.Request_ATR2ViDocument_getAllComp;

import com.sap.atr2model.Request_ATR2ViDocument_saveCand;

import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable;

import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;

import com.sap.wdp.IPrivateATRView;

//@@end

//@@begin documentation

//@@end

public class ATRView

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(ATRView.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

/**

  • Private access to the generated Web Dynpro counterpart

  • for this controller class. </p>

*

  • Use <code>wdThis</code> to gain typed access to the context,

  • to trigger navigation via outbound plugs, to get and enable/disable

  • actions, fire declared events, and access used controllers and/or

  • component usages.

*

  • @see com.sap.wdp.IPrivateATRView for more details

*/

private final IPrivateATRView wdThis;

/**

  • Root node of this controller's context. </p>

*

  • Provides typed access not only to the elements of the root node

  • but also to all nodes in the context (methods nodeXYZ())

  • and their currently selected element (methods currentXYZElement()).

  • It also facilitates the creation of new elements for all nodes

  • (methods createXYZElement()). </p>

*

  • @see com.sap.wdp.IPrivateATRView.IContextNode for more details.

*/

private final IPrivateATRView.IContextNode wdContext;

/**

  • A shortcut for <code>wdThis.wdGetAPI()</code>. </p>

  • Represents the generic API of the generic Web Dynpro counterpart

  • for this controller. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

/**

  • A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>

  • Represents the generic API of the Web Dynpro component this controller

  • belongs to. Can be used to access the message manager, the window manager,

  • to add/remove event handlers and so on. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public ATRView(IPrivateATRView wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

//@@begin javadoc:wdDoInit()

/** Hook method called to initialize controller. */

//@@end

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.nodeRequest_ATR2ViDocument_getAllCand().bind(new Request_ATR2ViDocument_getAllCand());

wdContext.nodeRequest_ATR2ViDocument_delCand().bind(new Request_ATR2ViDocument_delCand());

wdContext.nodeRequest_ATR2ViDocument_saveCand().bind(new Request_ATR2ViDocument_saveCand());

wdContext.nodeRequest_ATR2ViDocument_getAllComp().bind(new Request_ATR2ViDocument_getAllComp());

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

wdContext.currentRequest_ATR2ViDocument_getAllCandElement().modelObject().execute();

wdContext.currentRequest_ATR2ViDocument_getAllCompElement().modelObject().execute();

} catch(Exception ce) {

manager.reportException(ce.getMessage(), false);

}

manager.reportSuccess(wdContext.nodeRequest_ATR2ViDocument_getAllCand().nodeResponse().nodeResult().size()+" Candidat(s) trouvé(s)");

//@@end

}

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

//@@begin javadoc:wdDoModifyView

/**

  • Hook method called to modify a view just before rendering.

  • This method conceptually belongs to the view itself, not to the

  • controller (cf. MVC pattern).

  • It is made static to discourage a way of programming that

  • routinely stores references to UI elements in instance fields

  • for access by the view controller's event handlers, and so on.

  • The Web Dynpro programming model recommends that UI elements can

  • only be accessed by code executed within the call to this hook method.

*

  • @param wdThis Generated private interface of the view's controller, as

  • provided by Web Dynpro. Provides access to the view controller's

  • outgoing controller usages, etc.

  • @param wdContext Generated interface of the view's context, as provided

  • by Web Dynpro. Provides access to the view's data.

  • @param view The view's generic API, as provided by Web Dynpro.

  • Provides access to UI elements.

  • @param firstTime Indicates whether the hook is called for the first time

  • during the lifetime of the view.

*/

//@@end

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

{

//@@begin wdDoModifyView

if (firstTime) {

IWDTable table = (IWDTable) view.getElement("Table");

wdContext.currentContextElement().setTableSorter(

new TableSorter(table, wdThis.wdGetSortAction(), null));

}

//@@end

}

//@@begin javadoc:onActionFilter(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionFilter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionFilter(ServerEvent)

//@@end

}

//@@begin javadoc:onActionSupprimer(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSupprimer(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSupprimer(ServerEvent)

int n = wdContext.nodeResult().size();

int leadSelected = wdContext.nodeResult().getLeadSelection();

// loop backwards to avoid index troubles

for (int i = n - 1; i >= 0; --i) {

if (wdContext.nodeResult().isMultiSelected(i) || leadSelected == i) {

try{

//get the id of the cand

String id = wdContext.nodeResult().getElementAt(i).getAttributeValue("id").toString();

wdContext.nodeResult().removeElement(wdContext.nodeResult().getElementAt(i));

//We need to remove in the database too

wdContext.currentRequest_ATR2ViDocument_delCandElement().modelObject().setIdcand(id);

wdContext.currentRequest_ATR2ViDocument_delCandElement().modelObject().execute();

}catch(Exception e){

}

}

}

//@@end

}

//@@begin javadoc:onActionSelect(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSelect(ServerEvent)

//@@end

}

//@@begin javadoc:onActionSort(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSort(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSort(ServerEvent)

wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.nodeResult());

//@@end

}

//@@begin javadoc:onActionAjouter(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionAjouter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionAjouter(ServerEvent)

//@@end

}

//@@begin javadoc:onActionAjouteruncandidat(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionAjouteruncandidat(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionAjouteruncandidat(ServerEvent)

try{

wdContext.currentRequest_ATR2ViDocument_saveCandElement().modelObject().execute();

}catch(Exception e){

e.printStackTrace();

}

//@@end

}

/*

  • The following code section can be used for any Java code that is

  • not to be visible to other controllers/views or that contains constructs

  • currently not supported directly by Web Dynpro (such as inner classes or

  • member variables etc.). </p>

*

  • Note: The content of this section is in no way managed/controlled

  • by the Web Dynpro Designtime or the Web Dynpro Runtime.

*/

//@@begin others

//@@end

}

// -

-


content of obsolete user coding area(s) -

-


//@@begin obsolete:javadoc:FILTER(ServerEvent)

// /** Declared validating event handler. */

//@@end

//@@begin obsolete:Supprimer(ServerEvent)

//@@end

//@@begin obsolete:javadoc:Supprimer(ServerEvent)

// /** Declared validating event handler. */

//@@end

//@@begin obsolete:FILTER(ServerEvent)

//@@end

Former Member
0 Kudos

Frantz,

And what action is not working? Plz provide action handler name.

VS

Former Member
0 Kudos

onActionAjouteruncandidat is the action where the refresh on the table is not made

Former Member
0 Kudos

Frantz,

Am I correct whith the following guess: Table dataSource is node nodeRequest_ATR2ViDocument_getAllCand or table cell editors is bound to this node, but form controls use node nodeRequest_ATR2ViDocument_saveCand instead? So, table cell editors and form controls bound to different attributes?

If so, then no automatic "synchronization" possible, you have to copy values manually (in action handler) between node elements.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

thank you valery,

that's right so i have to make it manually.

Answers (0)