cancel
Showing results for 
Search instead for 
Did you mean: 

How Do You Populate Dropdown Lists?

Former Member
0 Kudos

I am having a problem when I fill more than one drop down list (using DropDownByIndex). What happens is I have 2 that I want to fill. It seems to be leaving a big space in each one where the values for the other one would be filled in. So for example, the first one has a big space at the end, and the second one has a big space at the beginning.

Here is the logic I am using to fill:


String firstList[]={"One","Two","Three"};
String secondList[]={"Four","Five","Six"};
	
for(int i=0;i<firstList.length;i++){
   IPrivateBlah.IDataElement ele=wdContext.createDataElement();
   ele.setFirstList(firstList<i>);
   wdContext.nodeData().addElement(ele);
}
		
for(int i=0;i<secondList.length;i++){
   IPrivateBlah.IDataElement ele=wdContext.createDataElement();
   ele.setSecondList(secondList<i>);
   wdContext.nodeData().addElement(ele);
}

Any ideas why this is happening?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What dou you mean with "big space"? Do you mean that there appears an empty list entry (which allows to clear the selection)?

I don't understand your code either: You have two dropdown lists but you are filling all entries into one context node. How is this supposed to work?

Armin

Former Member
0 Kudos

I know, this doesn't seem to be the correct way to do this. Can you help me to use the right way? I just want 2 drop downs with some values that are static. Sorry, I am very new to web dynpro.

Former Member
0 Kudos

Ok, here a short tutorial. There are two kinds of dropdown lists: *ByIndex and ByKey.

To fill a DDByKey, create a DDIC type using the type editor and add enumeration values (and descriptions)

Example:

Create DDIC type "ShirtSize" with enum values ("S", "Small"), ("M", "Medium"), ("L", "Large")

Create context attribute "selectedSize" of type "ShirtSize"

Data binding: DropDownByKey.selectedKey -> selectedSize

Now, the dropdown list will display "Small", "Medium", "Large" and if you select for example "Large", the context attribute "selectedSize" contains value "L".

DDByIndex works differently. I think your problem is solved more easily with DDByKey.

Armin

Former Member
0 Kudos

Perfect - that helped very much. Thank you!!!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sarah..

Try to check the cardinality values...May be this , U can get these type of events..

URs GS

Former Member
0 Kudos

Thank you for the response. The cardinality is 1..n and the selection is 1..1.