cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter mapping

Former Member
0 Kudos

Hi developers

I am trying to use test application on tree in WD. I am trying to implement test application on tree's ( available on code samples in SDN ).

In this project parameter mapping has been used .

In domodify view following code has been written

IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");

treeNode.mappingOfOnAction().addSourceMapping<b>("path</b>", "selectedElement");

treeNode.mappingOfOnLoadChildren().addSourceMapping<b>("path",</b> "element");

The above line is necessary to create parameter mapping from parameter "path" to parameter "element".

but I am not able to understand from where we are getting client side parameter

<b>"path" </b> .

also I need to know why we put parameter mapping code in do modify view knowing that it will only be executed only first time.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Ullrich

Now its quite clear from where this event paramater is comming.

but can you tell me the code please to fetch which constant is mapped for it.

Regards

abhay

Hullen
Advisor
Advisor
0 Kudos

Hi Abhay,

well, the TreeNodeType has 2 event parameters automatically declared: <b>Path</b> and <b>NodeElement</b>.

In the example that you have given there, the event parameter <b>Path</b> is mapped to the action parameter <b>selectedElement</b> and <b>element</b>, depending on the event that is triggered.

so in your actionEventHandler methods (onActionXxxx) there should be an additional action parameter (<b>selectedElement</b> or <b>element</b>, respectively) that contain the event parameter's value at runtime.

The value of those 2 event parameters are determined by the runtime environment whenever the event is triggered, I don't think you have control over that. But of course you can take some action based on the value of that action parameter within the actionEventHandler.

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank a lot for knowledge transfer Ullrich.

Regards

Abhay.

Hullen
Advisor
Advisor
0 Kudos

Hi Abhay,

parameter mapping allows you to pass a predefined (constant) event parameter from a view element to an action handler. In this case you are passing the current <b>path</b> of the Node that is triggering the action to the actionEventHandler, so that you know where in the tree structure the event has occurred when you want to handle the action.

At design time, you can call the context menu of a view element in the IDE and select <b>Parameter Mapping</b> from it so see which constants are currently declared (and mapped) for it.

And you put the Parameter Mapping in wdDoModifyView, because it is effecting the view elements directly You should not access view elements in methods outside of wdDoModifyView, and for actions such as parameter mapping there is the boolean firstTime to prevent multiple calls.

Former Member
0 Kudos

Hi kalyan

thanks for valuable reply but I really dont understand where this client side parameter is defined.

also if possible please clarify why we use it in WDdoModify method if its going to be called only once.

Regards

Abahy

Former Member
0 Kudos

Hi Abhay

Adds a new parameter to the parameter mapping. The parameter is read from

the mapping source and stored in this instance.

@param sourceName name of the parameter in the mapping source object

@param newName name of the parameter after mapping

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

In the above statement path the source name and target is the selected Element

Selected element should be added as part of the parameter of the action.

Regards

Ayyapparaj.

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi Abhay

The Parameter Passing is used in webdynpro is to send some information from the client side to server.For example in Tree Type UI element.The data in the column is expanding.Before population we need to know the Selected Element.

Thats why you are passing the element with key " path " .This information of key is fixed and you need to use these keys only.This is because of Recognization in the server what data you are sending.

Regards

kalyan