cancel
Showing results for 
Search instead for 
Did you mean: 

Populating drop down list with ArrayList

Former Member
0 Kudos

Hello experts,

I'm developing a webdynpro application that needs to dynamically populate a drop down by key UI Element based on an ArrayList... Can anyone help me, I'm kinda stuck here.. thanks in advance.

JV

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you use DDByKey, you have to populate the value set of the DDIC type of the context attribute to which the "selectedKey" property is bound. Search the forum for "ModifiableSimpleType".

Armin

Former Member
0 Kudos

Thank you Armin, but I'm kinda new to this stuff, can you explain me in detail how could I work with this.. I have already an instance of the ModifiableSimpleType, but how do I bind it to the context.. thanks in advance.

JV

Former Member
0 Kudos

Hi Jesus.

What Armin meant was this:


//Use of ISimpleTypeModifiable to populate dropdowns by key
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateMain.IContextElement.ATTRIBNAME);
ISimpleTypeModifiable attribNameType = attributeInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = attribNameType.getSVServices().getModifiableSimpleValueSet();
//Clear previous data
valueSet.clear();
//on this part just extract those values from arraylist and craft your  Key-Text pairs
//mm dunno, you can iterate 
for (int i = 0; i <= 400; i++)   
{
  valueSet.put("Key_"+i,"Text "+i);
}


//Anoter method to achieve the same, more direct xD
IModifiableSimpleValueSet ValueSet = wdContext.getNodeInfo().getChild("<your table nodename>").
                     getAttribute("drop_attrib_name").getModifiableSimpleType().getSVServices().
getModifiableSimpleValueSet();

//Same here, you could iterate extracting those Key-Text pairs and put into ValueSet
ValueSet.put("Key","Text");         
 //etc

Regards

Julio Herrera

Former Member
0 Kudos

Hey man, thanx a lot, that worked out!

Cheers!

Former Member
0 Kudos

Hi,

can anyone tell me how can we do this for dropdownbyIndex?

Answers (0)