Hello,
I'm using NWDS 7.0.18.
Here is my problem...
I have 2 Views, viewA and viewB and a component controller; comp.
The comp has in its context a node and in this node is a recusion node child_node who has a property repeatedNode type node.
viewA and viewB have its context mapped to this node in the comp but the repeatedNode child_node had to be created in their own contexts as they could not be mapped (option to map not available).
Now, upon clicking the Insert button on viewA, a modal window is created that contains viewB.
viewB accepts user input and upon clicking the Add button in viewB it should add the element in the appropriate lead selected position in the table, viewB is then destroyed.
Here is the code in viewA that calls the modal window when the Insert button is clicked.
public void onActionInsertNode(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
com.sjm.wdp.wdp.IPrivateGLPoCCompView.IHierarchyElement element )
{
IWDWindowInfo wndInfo = (IWDWindowInfo)wdComponentAPI
.getComponentInfo()
.findInWindows("InsertNodeWnd");
IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(wndInfo);
window.setWindowPosition(400,200);
wdContext.currentContextElement().setInsertViewWndInst(window);
window.show();
}
Here is the code in viewB which should insert the relevant element in the correct position in the hierarchy, but it doesn't, it inserts it under the root only.
public void onActioninsertNode(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
IPrivateInsertNodeView.IHierarchyElement selectedElem
= (IPrivateInsertNodeView.IHierarchyElement) wdContext.nodeHierarchy().getTreeSelection();
IPrivateInsertNodeView.IHierarchyElement newElem
= selectedElem.nodeHierarchy_Child().createHierarchyElement();
newElem.setNODE_TITLE(wdContext.currentInsertElement().getName());
newElem.setID(wdContext.currentInsertElement().getName());
newElem.setPERS_RESP(wdContext.currentInsertElement().getPersResp());
selectedElem.nodeHierarchy_Child().addElement(newElem);
}
Now remember both viewA and viewB have their context mapped to comp.
I have a feeling when I'm doing the insert in viewB the call to getTreeSelection is returning not the actual selected tree node, but the root node because I'm working with the context in viewB and its the context in viewA that has the "real" lead selected.
How can I overcome this please??
Marshall.