cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a node selection in a table using Arraylist

udaykumar_kanike
Active Contributor
0 Kudos

Hi All,

Can someone help me with the code to get the node selected value from a table and then set that values to input fields?

Early response would be much appreciated.

Thanks

Uday

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

the lead selection can not help?

udaykumar_kanike
Active Contributor
0 Kudos

Hi john,

Can you please suggest me some code to get the selected row of a table and put that in the input fields ?

Thanks

Uday

junwu
Active Contributor
0 Kudos

i suggest you should read some basic tutorial regarding web dynpro

wdContext.node<NodeName>().get<NodeName>ElementAt(wdContext.node<NodeName>().getLeadSelection())

you can also check onLeadSelect event of the table

udaykumar_kanike
Active Contributor
0 Kudos

Hi John,

I have written following code for lead selection. but in this case, i could get only able to fetch the values of only one column,

how can i change this code for 4 more columns.

ArrayList list = null;

if (wdContext.nodeOutputOvs().getLeadSelection() == 0) {

int j = wdContext.nodeOutputOvs().getLeadSelection();

list.add(wdContext.nodeOutputOvs().getElementAt(j));

}

for(int b=0; b<list.size(); b++) {

String Tprog = (String) list.get(b);

ovsCallerNodeElement.setDWS_Tporg(Tprog);

}

Please help me enable this code for 4more columns

Thanks

Uday

junwu
Active Contributor
0 Kudos

after you get the element, you can get all the attribute.

please thinking more...................

p330068
Active Contributor
0 Kudos

Dear Uday,

Please user the isMultiSelected inside the for loop and iterate through all the rows selected to set in the arraylist.

Refer to this might help:


if(wdContext.node<Node Name>().size()>0)
{
            // Iterate through the context Node
            for(int i=0;i<wdContext.node<Node Name>().size();i++)
            {			
	  if(wdContext.node<Node Name>().isMultiSelected(i))  {
	             // Set the ArrayList here for the Lead Selected elements of the Table multiple selected rows
                        }else {
                               // Set the ArrayList here for the Lead Selected elements of the Table single selected rows
                         }
            } 				
}

Best Regards

Arun Jaiswal

Edited by: Arun Jaiswal on Dec 10, 2011 2:04 PM

udaykumar_kanike
Active Contributor
0 Kudos

Thanks Arun,

your help link was very helpful.

but in my case i need to add 4 attribute values to Arraylist. So, i just wanted to ask, if its valid to keep adding each attribute to the list. i feel that only one attribute and its values could be added to the list. for eg.

list.add(wdContext.nodeOutputOvs().getElementAt(j).getTprog());

list.add(wdContext.nodeOutputOvs().getElementAt(j).getTtext());

list.add(wdContext.nodeOutputOvs().getElementAt(j).getsollz());

list.add(wdContext.nodeOutputOvs().getElementAt(j).getsobeg());

list.add(wdContext.nodeOutputOvs().getElementAt(j).getsoend());

please tell me if the above code is valid for list. in this case, i am inserting values of five attributes of a table to array list. if i execute this statement, i feel i would only be able to add the last row and first four rows get over written.

is there any alternative to Arraylist?

Thanks

Uday

p330068
Active Contributor
0 Kudos

Dear Uday,

I had added the code for the multi selected row. I forgot to mentioned for the column.

Created one custom context node and attributes same as table context node and attributes.

Create the object for the custom context node and populate the value with below :-

If only one row selected then you can get the selected row details with currectNode<Node Name> OR get leadSelection then set to the custom context node attribute.

If mulitiple rows selected then you need to loop through for loop and get the current selected element and set to custom context node attribute.

Hope it will helps,

Best Regards

Arun Jaiswal

Answers (0)