cancel
Showing results for 
Search instead for 
Did you mean: 

table with buttons in one column

Former Member
0 Kudos

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

----


name

----


firstName

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Armin,

it works! Thank you!

But how does this work exactly with the parameter mapping in backround?

Regards,

Armin

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Armin,

And how does the runtime know which Node Element has to be set to the parameter? Does the runtime references the Button to the Table-Row and the Table-Row to the Node Element?

Regards,

Armin

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Ayyapparaj,

where do I have to add this code?

And how can I intialize IWDButton button with = //Your Button;

Regards,

Armin

Former Member
0 Kudos

Hi,

In the wdDoModifyView

IWDButton button = view.getElement("<Name of the Button>")

Regards

Ayyapparaj

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Ayyapparaj,

If I do point 3 I don't have to do poiunt one.

Regards,

Armin