Display selected row in a popup window in Web Dynpro Java

1.1k Views Asked by At

I have a table with element, and a Delete button.

My requirement is: when I select one element, if I push this button, it open a pop-up with the same table but ONLY with the element selected.

Here is the code of "action" for the "delete" button:

public void onActionDeleteElement(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
      {
        //@@begin onActionDeleteElement(ServerEvent)
           logger.entering("onActionDeleteElement");
        
            IWDWindowInfo windowInfo = (IWDWindowInfo) wdComponentAPI
                    .getComponentInfo().findInWindows("Popup_View");
            IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(
                    windowInfo);
            window.setTitle("Selected");
    
            window.show();
    
         
            logger.exiting("onActionDeleteElement");
        //@@end
      }

I really need help, please.

Thank you.

1

There are 1 best solutions below

0
On

Actually, it seems that you've binded both tables to the same datasource (the same node), and thus second table shows the same content. In your case it would be complicated to implement the given requirement. The most simple way to do this would be:

  1. Unbind popup table from common node.
  2. Create separate node for popup table and bind table to it.

In wdDoInit method of popup view/window

  1. Get current element of common mapped node .

    IWDNodeElement element = mappedNode.getCurrentElement();
    

    You should check also if that node allows multiselection.

    mappedNode.isMultiSelected(i)
    
  2. Add selected elements to the popup node

    popupNode.addElement(element);