cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically binding simpletype to a dropdownbykey??

Amey-Mogare
Contributor
0 Kudos

Dear All,

How to bind a existing simpletype to a dropdownbykey UI element?

I have set of simpletypes created and I want to assign them to dropdownbykey UI element ( statically created). How do I go about it?

Pls help. Can anybody give me sample code for this?

I am writing following code in my wdModifyView method:-

IWDDropDownByKey combs = (IWDDropDownByKey) view.getElement(<UI element ID>);

combs.bindSelectedKey(<simpletypename>);

But it is throwing context exception "Unknown child node"

regards,

Amey

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Amey,

First you must create a context attribute of that of simpleType.

e.g. If your context structure is like this:

node -> key (attribute name)

Then change your code like this:

combs.bindSelectedKey("node.key" );  
// Context path you have to give there.

Regards,

Siva

Amey-Mogare
Contributor
0 Kudos

I have already created context attribute for these simpletypes.

What I want to do is to assign one of them dynamically to the dropdownbykey !!!

Suppose :-

1. UI element ID of my dropdownbykey is "DropDownByKey2"

2. context attribute : combs1 of type "com.myproject.simpletypes.combsList1"

3. context attribute : combs2 of type "com.myproject.simpletypes.combsList2"

Now depending on some condition, i want my dropdownbykey to have list either combs1 or combs2..

So how do i do that?

regards,

Amey

Former Member
0 Kudos

How is the exact context structure?

Armin

Amey-Mogare
Contributor
0 Kudos

See ... i have three context value attributes:-

1. context value attribute : combs1 of type "com.myproject.simpletypes.combsList1"

2. context value attribute : combs2 of type "com.myproject.simpletypes.combsList2"

3. context value attribute : combs3 of type "com.myproject.simpletypes.combsList3"

Now my purpose is to bind one of these attributes to a SINGLE dropdownbykey UI Element dynamically !!!

That means initially I am binding combs1 to UI element's 'Selected key" property.

I hope i am explaining you my scenario correctly !!!

regards,

Amey

former_member197348
Active Contributor
0 Kudos

Hi Amey,

in wdDoModifyView()

IWDDropDownByKey combs = (IWDDropDownByKey) view.getElement("DropDownByKey");

//if condition
combs.bindSelectedKey("combs1");
//else if condition
combs.bindSelectedKey("combs2");
//else
combs.bindSelectedKey("combs3");

Like this you can set your single drop down UI element dynamically.

Regards,

Siva

Answers (1)

Answers (1)

Former Member
0 Kudos

The "selectedKey" property has to be bound to a context attribute of the DDIC type with value-set.

Armin