Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dynamic Binding of Node to DropdownBYKey

Hi Colleagues,

I am new to WebDynpro.

I am facing an issue with "DropDownByKey" UI Element.

The scnario is:

1) There are 15 number of "DropDownByKey" UI Elements to be displayed on a page with the same data (time intervals).

One approach to achieve this would be:

1) Create a 15 attributes of simple data type and enter options in

enumerations.

2) Now bind each of these simple data types to all the 15 DropdownByKey elements.

The second approach could be:

1) Create a node with attribute type string.

2) Write functionality to add values to this attribute.

3) Create instances of Node.Attribute.

4) Bind these instances to individual 15 DropdownBykeys elements.

Please tell me which one of the two approaches would be better or if there is any other better approach.

In case, if the second appraoch is better, how to achieve this?

Thanks & Regards,

Ankit.

replied

Hi,

Create one SimpleType in Dictionaries with time data .

Then use Dynamic programming to achieve your need

in wdDomodifyView() method, write following code

wdContext.getContext().reset(false);

IWDTransparentContainer tc= (IWDTransparentContainer)view.getElement("RootUIElementContainer");

tc.destroyAllChildren();

for(int i=0;i<15;i++)

{

wdContext.getNodeInfo.addAttribute("attr"+i,"<SimpleTypePackage>.<SimpleTypeName> ");

}

for(int k=0;k<15;k++)

{

IWDDropDownByKey ddk=(IWDDropDownByKey)view.createElement(IWDDropDownByKey.class,"ddk");

ddk.bindSelectedKey("attr"+k);

tc.addChild(ddk);

}

Regards

LN

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question