cancel
Showing results for 
Search instead for 
Did you mean: 

Table

david_fryda2
Participant
0 Kudos

Hi,

I created un table that get results from a BAPI.

Everything works fine.

Now, I am trying to get the line where the user would click on and extract the data of this line.

How do I create a listener and how to get the data, the index of the line selected.... ?

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

1. Create an action (AN_RowSelect)

2. Assign the action to the "onLeadSelect" property of the table.

3. Create an action handler (onActionRowSelect)

4. In the action handler implement the following code.

int nSelectedRow = wdContext.nodeVnResultTable().getLeadSelection();

IPrivateMyViewView.IVnResultTableElement nodeEltVnResultTable = wdContext.nodeVnResultTable().getVnResultTableElementAt(nSelectedRow);

Once you get the selected row element, you can access the column values by

String col1 = nodeEltVnResultTable.getCol1Value();

String col2 = nodeEltVnResultTable.getCol2Value();

Hope this solves your problem.

Regards,

Santhosh.C

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi David

The following code deals deleting a row similar lines we can select add the row

onActionDeleteProduct()

//@@begin onActionDeleteProduct(ServerEvent)

int n = wdContext.nodeProducts().size();

int leadSelected = wdContext.nodeProducts().getLeadSelection();

// loop backwards to avoid index troubles

for (int i = n - 1; i >= 0; --i)

{

if (wdContext.nodeProducts().isMultiSelected(i) ||

leadSelected == i)

{

wdContext.nodeProducts().removeElement(wdContext.nodeProducts().

getElementAt(i));

}

}

//@@end

To avoid problems with the index, the context is here executed in reverse. All

elements selected in the table are deleted.

Hope this helped you

Regards,

RK

Former Member
0 Kudos

Hi,

As Valery said you can retrieve the details of the clicked row using

wdContext.current<node>Element.get<element>

in the actionhandler for the onLeadselect Action of the table.

Regards

Noufal

david_fryda2
Participant
0 Kudos

Thanks everyone, it works!

I just notice that using WebDynPro is not straigh forward as if you were coding the application by yourself.

I do not know how to deliver you the rewards points since you are many people to give me the answers.

So, I will try to do my best.

Thanks again.

former_member182372
Active Contributor
0 Kudos

Hi,

You can access selected element through getLeadSelection of table data source in onLeadSelect (table event) event handler.

Regards, Maxim R.

Former Member
0 Kudos

Hi David,

1. Create Action (see coresponding tab of View Controller editor) -- the process is straighforward, no parameters are necessary.

2. Assign action created to Table UI <b>OnLeadSelect</b> property.

3. In generated action handler for this Action you may use wdContext.node<YourTableNode>().current<YourTableNode>Element to get/set properties of record selected.

VS

Former Member
0 Kudos

Hi,

You can get the selected row information from the context as below.

wdContext.current<Node>Element().get<<Attribute1>>

wdContext.current<Node>Element().get<<Attribute2>>

etc

Create an action and bind the action to the OnClick event of the Table and you can write the above statements in the action.

Regards, VIP