cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByKey

Former Member
0 Kudos

how do i set the default of DropDownByKey

for instance i have several item in DropDownByKey

[Purchase List ]

- shoes

- blouser

- shirt

- jeans

if i want to set my shirt as default ..how to do this..

Accepted Solutions (1)

Accepted Solutions (1)

dhawal_joshi
Employee
Employee
0 Kudos

Hi ,

The UI element dropdownbykey , you might have binded the context attribute which was in turn mapped to the simple type. To select a default value you could set the attribute value as well to the one which you want as default.

In default case it picks the value which has key value 0 ( generated automatically at design time )

regards

Answers (9)

Answers (9)

Former Member
0 Kudos

Hai,

wdContext.currentContextElement().setPurchase List("shirt");

Regards,

Naga

nitin_mahajan2
Contributor
0 Kudos

Yea, as Armin said, the first thing one needs to do for any query is to check the Java Docs.

Former Member
0 Kudos
Former Member
0 Kudos

Hi yzme,

There are 2 ways of doing that:

1.Attribute that you've binded to DDKey UI element.Stores the key of the rendered value at runtime.So set it to the default key (say Key 0 ) in your case.

2.In the wdModifyView you can get the DDByKey element and it has a method

as setSelectedkey("Default key");

Regards

Amit

Former Member
0 Kudos

Hi,

You can set the default value of the DDBK if you know the key value of the attribute that is displayed.

Assuming "PurchaseList" as the attribute that is mapped to selecteKey property of the drop down by key.

wdContext.currentNodeDDBK.setPurchaseList(<your key for shirt>);

Former Member
0 Kudos

Hi,

1)Create simple type and click Enumeration tab,then click New

2)Enter the Shirt as your first element,then it will set as default key 0

3)Create an attribute as SELECT and bind this attribute with simple type

4)Insert Dropdownbykey UI element,bind this with SELECT attribute

5)While runtime,shirt will set as first element....

Former Member
0 Kudos

Hi Yzme,

I understand that you created SimpleTypeDictonary for your DropDownValues and your context attribute is binded with above SimpleTypeDictonary. And your DD UI element is mapped with context attribute.

In the view of init or outboundplug method.

wdContext.currentContextElement()set<<b>ContextAttributeName</b>>("<b>SimpleTypeDictonary Value</b>");

B for blouser

Default Value

Exp :wdContext.currentContextElement()setPurhaseDD("B");

Rgds

SS

Former Member
0 Kudos

Hi yzme,

U have to get the key for the value shirt & set it as selected key in wdDoInit.

dropdownName.setSelectedKey(<key>);

regards

Sumit

Former Member
0 Kudos

Hi,

use setLeadSelection() method on your node which you have bind to your DropDown. For Example

wdContext.nodeAirlineValue().setLeadSelection( int element no);

Thanks and Regards

Avijit