cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Default value in Dynamic Dropdown UI Element

Former Member
0 Kudos

HI,

I have created a value node XXX(static) and a simpletype(to display in the dropdown values say 1 to 10) .3 more dynamic value attributes(V1,V2,V3) are created for this value node XXX.I have created 3 Dropdown UI Elements dynamically and bind these Dropdown UI elements with these value attributes as well as with the sympletype.

The three dropdown UI elements as well as values are coming perfect.

I want to set the default values for these dropdown i,e

1st dropdown should display 2 (by default)

2nd dropdown should display 5(by default)

3rd dropdown should display 10 (by default).

Default valued are different for all the Dropdowns.

*.I tried with this options

wdContext.nodeXXX().setLeadSelection(0).

wdContext.nodeXXX().setLeadSelection(-1).

These options are not working.

My value node XXX is static,but my value attributes for this node XXX are dynamic.The 3 Dropdown UI Elements are also *Dynamic

Please suggest me.Thanks in advance.

Regards

-Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Armin,

I did the same thing.

The dropdown values are still showing Blank.

Ideally it should show with some values in the dropdown.

Do I need to change the cardinality of the static node XXX and the select property of this node?

The current cardinality of the node is -->0..n

select property -->0..1

please suggest.Thanks in advance

Former Member
0 Kudos

Hi,

As Armin said use the following:


wdContext.nodeXXX().currentXXXElement().setAttributeValue("attributeName", value)

Here you give the value as value of simpleType and not its description.

thanks & regards,

Manoj

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Armin/Manoj/Pinki

Thanks for giving accurate answer.

Marks has already given to u.

Thanks to u all.

Former Member
0 Kudos

hi,

You can use the following code in the WddoModifyView:

//creating dropdownkey

IWDDropDownByKey key = (IWDDropDownByKey)view.createElement(IWDDropDownByKey.class,"Dropkey");

key.bindSelectedKey("DropKey.Key");

key.setWidth("60");

key.setVisible(WDVisibility.VISIBLE);

// Here you are setting the default to the second element.

key.setSelectedKey("2");

Former Member
0 Kudos

To select a value in the drop-down list, you just have to set the context attribute value (assuming the "selectedKey" property is bound to that attribute).

wdContext.nodeXXX().currentXXXElement().setAttributeValue("attributeName", value)

Armin