cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByKey fill with items

Former Member
0 Kudos

Dear programmers,

I'm pretty new with the whole SAP NetWeaver stuff, but it's really cool.

How is it possible to add items in a dropdownbykey element?

I've made a context "ProjectSelection", but when I try to fill the context it doesn't appear in the drop down box.

How to solve this?

Regards,

Adri

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hai,

If you wan to display static data better to use DD Key, If you are retrieveing dynamica data better to Use DDByIndex.

If you want to show static data like Colors=REd,Blue,Green. create Simple type Of color, goto Enumeartion Tab enter Key Value Pairs like R=RED,etc.

create context attribute color of type color simpletype.

assign to DDKey value.

If you want to show dynamic data in DDIndex

Create a ContextNode -node--under node create attribute value

//get some data

for(int i=0;i<size;i++){

IprivateXXView.INodeElemen=wdcontext.createNodeelement();

ele.setValue(someVlue);

wdContext.nodeNode().addelement(ele);

}

Regards,

Naga

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi Nags and Abhijeet,

I have n't explored more into this error which happened in EP6 SP15. Now i am tested with SP16 and its working fine.

Thanks for your assistance.

I am awarding the points to both of you.

Sekar

Former Member
0 Kudos

Hm, that's much better, tnkx!

Former Member
0 Kudos

I've found it on my own.

The solution:

IWDDropDownByKey ddKey = (IWDDropDownByKey)view.getElement("..");

ddKey.setSelectedKey("...");

The code should be placed in the method "wdDoModifyView".

Former Member
0 Kudos

Is it possible to assign a 'selected' value to the dropdown box?

I tried:

wdContext.nodeProjectSelection().setSelected(0, true);

But that doesn't work. Some ideas?

Former Member
0 Kudos

Hai,

wdContext.currentProjectSelection().setXXX("....");

If you pass the key here, it will lead select the dropdown by key

Regards,

Naga

Former Member
0 Kudos

Great!!

Thanks for the replies, I've add some points.

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

1)goto Dictionary->Local Dctionay->Data Type->Right click Simple Type and say create new, say SimpType

2)on Enumeration tab, add some new values and description to your simple type,

3)create a context attribute say Ctx and set its datatype as a SimpleType created in last step ie. SimpType(for this you need to click on search icon button against its datatype property)

4)Once you are done with this , create a dropdownbykey UI element and bind it to the context attribute whose type is simpletype

build , deploy and run the application, it will give you what you want.

regards

sid_sunny
Contributor
0 Kudos

Hi Adri,

You can create a simple type dictionary element add the values in the enumeration and make a context attribute of this simple type element and bind it to DropDownByKey UI element.

Regards

Sid

Former Member
0 Kudos

Hi,

In order to populate the dropdown, do the follwoing:

Create a simpletype ,say 'elements', in Webdynpro Explorer under the node Dictionaries --> Local Dictionary --> Data types -- >simpleTypes.

Now open the simpletype by double clicking it. In the Enumeration tab, enter the values that you want to add in the dropdown, by pressing the 'New' button. The Enumeration is a key-value pair.

Now Create a value attribute in the context and set its data type to the simpletype u just created. Then, bind the dropdown UI with this simpletype! That's it.

Regards,

M.Subathra