on 12-20-2007 11:05 AM
Hello,
fitrst of all I use SAP NW CE.
I have a Table with 2 columns. In the first column I display data from a Context node of the View. The Context Node looks like this:
RequestFindPerson
---ResponseFindPerson
------returnFindPerson
----
----
I dispaly only the attribute name in the first column.
The second column contains a TableCellEditor with a Button. The Button has a onSelect-action.
In the onSelect-action-method I want to get the returnFindPerson-Node which are in the row of the selected button to put the element in an other Context Node.
How do I get this?
Regards,
Armin
Add a parameter "nodeElement" of type IWDNodeElement to the action.
In the Outline view, right-click on the button (cell editor) and select "Parameter Mapping...". Drag the action parameter on the right side to the "nodeElement" event parameter on the left side.
In the action handler, cast the "nodeElement" parameter to type IPrivate<ViewName>.IreturnFindPersonElement and access the attributes using this typed API.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What I have described just produces the same code as you would have added inside wdDoModifyView() manually. (In older IDE releases, you had to do this by code).
What happens at runtime is: The client transports a set of event parameter to the server, the HTML Client uses the parameter mapping definition to assign and convert these event parameters into the defined action parameters such that they can be used in the action handler.
Armin
The "nodeElement" parameter is special, it is available for each event. If a UI element is used inside some "data-driven" element like Table, Tree, RowRepeater etc., this parameter always contains the context node element that represents the "row", "tree node" etc. where the user interaction occurred. The information is encoded in the client-side IDs of the UI elements and decoded when the request is processed at the server.
Armin
Hi Armin,
If returnFindPerson is ur datasource for the table, just take the selected row.
int i = wdContext.nodereturnFindPerson.getLeadSelect & from the node u can get the i'th row .
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumit,
Yes returnFindPerson is my datasource.
I do this in my onActionAddPersonButtonPressed-method:
int row = wdContext.nodeReturnFindPerson().getLeadSelection();
IReturnFindPersonElement findPersonElement = wdContext.nodeReturnFindPerson().getReturnFindPersonElementAt(row);
But row is always 0.
There should be no pissibility ti select a row. I set selectionMode to none.
Regards,
Armin
Hi,
Have you tried this.
IWDButton button = //Your Button ;
button.mappingOfOnAction().addSourceMapping("nodeElement", "element");
This parameter should be of type IWDNodeElement.
From nodeElement you can access the node.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ayyapparaj,
I do it like this:
IWDButton button = (IWDButton)view.getElement("AddPersonButton");
Is this correct with the cast?
What do I exactly have to do with:
button.mappingOfOnAction().addSourceMapping("nodeElement", "element"); ?
And how can I get the returnFindPerson-element which are in the row of the selected button to put the element in an other Context Node in my onActionAddPersonButtonPressed-method?
Regards,
Armin
Hi,
Is this correct with the cast?
Yes,
What do I exactly have to do with:
button.mappingOfOnAction().addSourceMapping("nodeElement", "element"); ?
Adds a new parameter to the parameter mapping. The parameter is read from
the mapping source and stored in this instance
And how can I get the returnFindPerson-element which are in the row of the selected button to put the element in an other Context Node in my onActionAddPersonButtonPressed-method?
Create a parameter of type IWDNodeElement for the action assigned to the button.
Regards
Ayyapparaj
Hi Ayyapparaj,
"Create a parameter of type IWDNodeElement for the action assigned to the button."
I add a parameter with the name returnFindPerson of type IWDNodeElement.
"Adds a new parameter to the parameter mapping. The parameter is read from
the mapping source and stored in this instance"
The method addSourceMapping has this parameters:
sourceName name of the parameter in the mapping source object
newName name of the parameter after mapping
Is the parameter sourceName the name of my Context Node? So returnFindPerson?
Is the parameter newName the name of my added parameter of my onActionAddPersonButtonPressed-method?
-->
How do I have exactly to code this:
button.mappingOfOnAction().addSourceMapping("nodeElement", "element"); ?
Regards,
Armin
Hi,
Armin has just mentioned this.
1) Inside
public static void wdDoModifyView(IPrivatePlayView wdThis, IPrivatePlayView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
IWDButton button = (IWDButton)view.getElement("Button");
button.mappingOfOnAction().addSourceMapping("nodeElement", "element");
}
2)Add an Action Parameter from action tab
nodeElement of Type IWDNodeElement
3) From the outline right click on the button and select parameter mappin
map the parameter nodeelement from right to left.
4) from the action handler you can access the parameter nodeElement and the attributes
Regards
Ayyapparaj
Regards
Ayyapparaj
User | Count |
---|---|
84 | |
9 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.