cancel
Showing results for 
Search instead for 
Did you mean: 

Re:how to add new elements dynamically

Former Member
0 Kudos

Hello friends,

I am creating one button with name "Add Item" by clicking on that button need to add one text field dynamically. please give me some suggestions .

Regards,

sharadaDVPS

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

First, add a boolean context attribute named for example "inputFieldShouldBeAdded". In the action handler of the Add-button set this attribute to true. In the (static) hook method wdDoModifyView(), use code like


if ( wdContext.currentContextElement().getInputFieldShouldBeAdded() )
{
  IWDUIElementContainer container = /* whatever container the input field shall be added to */
  IWDInputField inputField = view.createElement(IWDInputField.class, "fieldID" /* may be null */);
  inputField.bindValue( wdContext.node<NodeName>().getNodeInfo().getAttribute(I<NodeName>Element.<ATTRIBUTE_NAME>);
  container.addChild(inputField);
  wdContext.currentContextElement().setInputFieldShouldBeAdded(false);
}

former_member183915
Active Contributor
0 Kudos

Hi ,

Refer this link :

Link:[http://help.sap.com/saphelp_sm32/helpdata/EN/c0/ead8a21ba49f4896c64851677f8ec9/content.htm]

You can also refer a site called SAP technical .com

Search for an article on Dynamic Run time Manipulation-Context & View layout using Web Dynpro for Java.

This would give a very clear and concise picture of what exactly needs to be done.

Regards ,

Navya

Former Member
0 Kudos

CHeck this wiki, should help you out, as its a simple and straight forward

http://wiki.sdn.sap.com/wiki/display/WDJava/DynamicUIGeneration

Former Member
0 Kudos

Answered in other thread :