How Do You Populate Dropdown Lists?
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?
Armin Reichert replied
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