cancel
Showing results for 
Search instead for 
Did you mean: 

a recursive tree and a confirmation dialog(popup)

Former Member
0 Kudos

Hi,

I am looking for a solution to the following problem.

In my WD application I have a recursive tree.

On OnSlect:

=============================================

public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.csn.wdp.IPrivateComponentTree.ITreeNodeElement selectedElement )

{

//@@begin onActionSelect(ServerEvent)

select(selectedElement);

//@@end

}

=============================================

Where the select method definition is:

=============================================

private void select(com.sap.csn.wdp.IPrivateComponentTree.ITreeNodeElement selectedElement)

=============================================

The selectedElement is previously mapped in the wdDoModifyView:

=============================================

treeNode.mappingOfOnAction().addSourceMapping("path","selectedElement");

=============================================

This works perfectly. Now, I would like to extend it, so that every time when a node is selected (OnSelect action), a popup to appear with a confirmation dialog. The dialog will have 2 options ok or cancel. In case of ok the select method will be called, nothing should change otherwise.

I modified the onActionSelect:

=============================================

//@@begin onActionSelect(ServerEvent)

IWDConfirmationDialog dialog = wdComponentAPI.getWindowManager().createConfirmationWindow(

"You will loose the entered data. Are you sure you want to load the new template?",

wdControllerAPI.getControllerInfo().findInEventHandlers("Select"),

"Yes");

dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("Cancel"), "No");

dialog.open();

=============================================

I added a new Event – Select – that is called with OK.

=============================================

public void Select(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.csn.wdp.IPrivateComponentTree.ITreeNodeElement selectedElement )

{

//@@begin Select(ServerEvent)

IWDWindow window = wdContext.currentContextElement().getConfirmationWindow();

if(window != null){

window.close();

}

select(selectedElement);

//@@end

}

=============================================

The problem is that I don’t know how to keep the value of the selectedElement and pass it from “onActionSelect” to the Select event? When I create the confirmation window, I can specify the name of the event but not its parameters:

wdControllerAPI.getControllerInfo().findInEventHandlers("Select")

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Albena,

In private section of controller (between //@@begin others -- //@@end at the very bottom of source code) create a field to hold a node element. In onSelect action handler store current element in this variable, in event handler for OK button use this variable.

VS

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Albena,

Let me know the solution

Regards, VIP

Former Member
0 Kudos

Hi Valery,

It works now!

Thanks for your help,

Alabena

Former Member
0 Kudos

See this:

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm

/people/mark.finnern/blog/2004/08/10/spread-the-love

VS

Former Member
0 Kudos

Hi,

i have created a recursive tree

Now i want to do the following things

1. Provide a checkbox to every node

2. if a node is checked then all its subnodes should be checked

(This is like context mapping in web dynpro i.e. if the root node is checked then all the nodes under it also gets checked.)

I read your problem....it seems somewhat similar to mine. But i coudnt understand ur code.

Can you please help me in solving this.

Former Member
0 Kudos

Hi,

i have created a recursive tree

Now i want to do the following things

1. Provide a checkbox to every node

2. if a node is checked then all its subnodes should be checked

(This is like context mapping in web dynpro i.e. if the root node is checked then all the nodes under it also gets checked.)

I read your problem....it seems somewhat similar to mine. But i coudnt understand ur code.

Can you please help me in solving this.

Thanks n Regards

Akshay

Former Member
0 Kudos

Hi Akshay,

1. I don't know if it is possible to add a checkbox next to every node in the tree?

2. If you find a way or know how to do it, then the second part will be probably easy to implement.

Regards,

Albena

Former Member
0 Kudos

Hi Akhay,

Were u able to add checkbox against every node?

Thanks,

Dhanya