cancel
Showing results for 
Search instead for 
Did you mean: 

Bind data to Dropdownlist in table field

ashish_shah
Contributor
0 Kudos

Hi Experts,

I have some data fetched and stored in a context.(In a value attribute under a value node.)

Lets call this node N1 and attribute A1.

I have a table with 5 fields.

Lets call thi table T1 and fields F1, F2 , F3 , F4 , F5.

Now to one of the table field(F1) i need to bind the values fetched in context attribute(A1).

Can anyone suggest how can i do this?

Thanks for your help in advance.

Regards,

Ashish

Accepted Solutions (0)

Answers (2)

Answers (2)

ashish_shah
Contributor
0 Kudos

i used input ui Element to show the data as value help. I still could not figure out a way to show three values in a drop down, i mean first column as key filed , second column as value filed and third column as Value field2.

ashish_shah
Contributor
0 Kudos

Hi Experts,

I have used the following code.


IWDAttributeInfo attributeInfo = wdContext.nodeCtx_vn_GTINSearch().getNodeInfo().getAttribute("ZGTYP1");
	ISimpleTypeModifiable simpleType = attributeInfo.getModifiableSimpleType();
	IModifiableSimpleValueSet valueSet = simpleType.getSVServices().getModifiableSimpleValueSet();
	valueSet.keySet().removeAll(valueSet.keySet());

	for(int j=0; j<wdContext.nodeCtx_vn_GTINType().size(); j++){

		String keyGTINType = wdContext.nodeCtx_vn_GTINType().getCtx_vn_GTINTypeElementAt(j).getZGTYP();
		String valueGTINType = wdContext.nodeCtx_vn_GTINType().getCtx_vn_GTINTypeElementAt(j).getZGTYPNAM();
		valueSet.put(keyGTINType,valueGTINType);
		
	}

But using this i can only see the values(valueGTINType) that i have populated.

I can not view key elements.

How can i show both values and keys together?

Regards,

Ashish Shah

ankur_garg5
Active Contributor
0 Kudos

Hi Ashish,

I suppose you are using a Drop Down UI element to display the list of values. See you cannot show both key and value pair in a drop down.

To do this, just replace the Drop Down UI element with an Input Field UI element. This would result in creating a Value Help, where you will have both keys and values. You won't need to make any change in the coding. Just bind the same context to the Input Field which was earlier bound to the Drop Down. For understanding more on Value Helps in Web Dynpro, see the following link:

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2833ce90-0201-0010-f1af-d3cfe1155b16">Value Help in Web Dynpro Applications</a>

<i>See page 6, you will see how a Value Help differs from a Drop Down.</i>

And if by any chance you wish to use a Drop Down only, then I can tell you a workaround. Replace the following line in your code:

valueSet.put(keyGTINType,valueGTINType);

by this:

valueSet.put(keyGTINType,keyGTINType+" - "+valueGTINType);

Bye

Ankur

Message was edited by:

Armin Reichert

ashish_shah
Contributor
0 Kudos

Hi Ankur,

Thanks for the suggestion.

I have already seen this tutorial. And i could bind the data to the input field.

I also want to know if i want to show more than two fileds in the dropdown or value help , how can i do that? ( For eg: keyGTINType,valueGTINType,value2GTINType ) .

Thanks,

Ashish Shah

Former Member
0 Kudos

hi,

If you want to show more than 2 elements, then you can use a popup instead of an EVS. This will solve your problem.

thanks & regards,

Manoj

ashish_shah
Contributor
0 Kudos

Hi ManojKumar,

Dont you think using Advanced Input Help - The Object Value Selector (OVS) ratahr than a pop up window would help ?

Anyways , how do i attach a pop up window to a context element?

Can you please elaborate on this?

Ashish