cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic UI generation

mark_manuel2
Explorer
0 Kudos

Hi,

I have a requirement to do the following:

A context exists which is defined to contain multiple items (ItemsName). The UI has an Add button to allow a user to add an item using an InputField. Everytime the user clicks on Add, a new Input Field get generated. In other words, I will need InputField_ItemName1 binded to the first item, InputField_ItemName2 binded to the second item and so on. The screen will have multiple Input Fields that represents that number of Items the user wants to add.

How do I go about doing this? After creating the element and the Input Fields in my current program, all the Input Fields get updated to whatever the last value I entered on any on the Input Fields generated. If I change the third Input Field, refreshing the screen updates all existing Input Fields to the value I entered.

Please help.

Thanks,

Mark

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What you want to do is not possible, namely binding input fields against individual node elements. You either have to use a context-driven UI element like Table or RowRepeater or you have to create individual context attributes and bind the input fields against these.

Armin

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi ,

Please have a look at below links,

https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7765. [original link is broken] [original link is broken] [original link is broken]

Regards,

Krishna chaitanya.

Former Member
0 Kudos
siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Mark

Each new InputField you are creating dynamically should be bound to a separate context attribute. So basically and very often when new UI control like InputField is dynamically created a developer has to create also a new context attribute which will keep the value of the field.

You can create a new attribute with method:

IWDAttributeInfo attrInfo = IWDNodeInfo.addAttribute(attrName, IDataType);

Then you have to bind a new input field to the attribute:

IWDInputField.bindValue(attrInfo);

Finally you can read the value typed by user:

IWDNodeElement.getAttributeValue(attrName);

Alternatively you may think also about Table control instead of the separate input fields. The Add button will just insert a new row in the table. It'll be much easier.

BR, Sergei

Former Member
0 Kudos

Hi Mark,

Have you read the documentation provided by SAP : [Dynamic UI Generation in Web Dynpro|http://help.sap.com/saphelp_nw70/helpdata/en/04/72a840bd6d3c13e10000000a155106/frameset.htm]? This documentation is quite good and there are some examples.

Regards,

Pierre