cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown List in a table column

Former Member
0 Kudos

Hello-

I'm using DAO Bean in a Web Dynpro Project. I have a table that is sourced from one of the objects, TableDataBO. Within TableDataBO I will have 4 columns and 1 of the columns needs to have a dropDown, called Fruits. FruitDataBO is also from same DAO.

How can I create a dropDownByIndex with selections from FruitDataBO but with it's value selected to the previously selected Fruit that is listed in TableDataBO.

For example, apple,orange,banana,pear.

TableDataBO.getFruit is orange. I'd like user to see the dropdown list and it be selected to orange. I'm not sure how I can implement this.

Thanks in advance.

Marty

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marty,

For this you have to create 2 nodes

1. A node which will be bound to the table. This will be a singleton node.

2. A node for dropdown. This node should be inside the table node and should be a non-singleton one.

Check the singleton properties of both the nodes above.

Whenever you will create an element for table node, an instance of the dropdown node will be automatically created.

To set the value in this dropdown at leadselection, you can use the below logic

1. Assume you know the value of the fruit to be set in the dropdown

2. for(int i = 0; i < wdContext.nodeFruit().size(); i++)

{

if( wdContext.currentTableNode().nodeFruit().getFruitElementAt(i).getFruit().equals(fruitName) )

{

wdContext.currentTableNode().nodeFruit().setLeadSelection(i);

break;

}

}

Hope this helps you.

MartyMcCormick
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank to both of you for the reply. I was able to solve my problem.

Answers (1)

Answers (1)

former_member214651
Active Contributor
0 Kudos

HI Marty,

Add a dropdownbyindex UI element to the Table column and bind it to a Context Node attribute with the Structure:

FruitDDByIndex

--FruitSelected

and in the code set DD of every row in the table.

for(int i = 0; i < <TableNodeSize>; i++)

{

<TableNodeObject> = wdContext.node<TableNode>.get<TableNode>ElementAt(i);

//Get the value to be selected

<TableNodeObject>.nodeFruitDDByIndex().getFruitDDByIndexAt(wdContext.nodeFruiDDByIndex().getLeadSelection).setFruiSelected(<value>);

}

Regards,

Poojith MV