cancel
Showing results for 
Search instead for 
Did you mean: 

Bydefault show the value in DropdownByKey

Former Member
0 Kudos

Hi ,

In table I created DropdownBy Key for values I took SimpleType. The values are showing in dropdown.But I want to show the one value in dropdown by defualt.

Please help me out.

Thanks

Risha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Risha,

make selection cardinality of ur dropdown's context Value node as 1:1.

Regards

Khushboo

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Hi,

In DoInit() method of View do the following

if example the DropDownByKey UI is bind with attribute country.

the country is of simple type Country.

then by default you can set country you desired using the below statement,

wdContext.currentContextelement().setCountry("IND");

here the "IND" is the value and description is INDIA in simple type.

so in DropDownByKey you can see the INDIA.

Regards,

ramesh

Former Member
0 Kudos

Hi ,

Thanks for reply.

I followed same procedure but I am getting "NullPointerException".

Thanks

Risha

Former Member
0 Kudos

post code ?

Former Member
0 Kudos

Hi ,

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.currentCtx_vn_ItemElement().

setCtx_va_Item("abc");

wdContext.currentCtx_vn_ItemElement().

setCtx_va_Item("xyz");

}

I have 2 rows in table.In first row dropdownbykey I want to show the "abc" and in 2nd row of dropdownbykey "xyz".

Thanks

Risha

Former Member
0 Kudos

HI,

For this, you have to change table leadselection also.

wdContext.node<TableNode>().setLeadSelection(0);

wdContext.currentCtx_vn_ItemElement().

setCtx_va_Item("abc");

wdContext.node<TableNode>().setLeadSelection(1);

wdContext.currentCtx_vn_ItemElement().

setCtx_va_Item("xyz");

Regards

LN

Former Member
0 Kudos

use this ,

public void wdDoInit()

{

//@@begin wdDoInit()

iprivate<ur view name>.ICtx_vn_ItemNode iCtx_vn_ItemNode = wdContext.nodeCtx_vn_Item();

iprivate<ur view name>.ICtx_vn_ItemElement iCtx_vn_ItemElement =

iCtx_vn_ItemNode.createCtx_vn_ItemElement();

iCtx_vn_ItemElement.setItem("abc");

iCtx_vn_ItemNode.addElement(iCtx_vn_ItemElement);

iCtx_vn_ItemNode.moveNext();

// repeat the italic statements to add second row.

}

Edited by: Ramesh Babu V on Sep 23, 2008 11:58 AM

former_member197348
Active Contributor
0 Kudos

Hi Risha,

You can set default value like this:

in wdDoInit()

wdContext.current<nodename>Element.set<DDattributename>("defaultkey");

Regards,

Siva