cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in DynamicUI Element (Input Field) Generation

Former Member
0 Kudos

Hi,

I am Developing a WebDynPro appln(Java) to create Dynamic UI elements through Coding.

I tried to create a simple Input Field Dynamically.While Running this appln It shows empty UserInterFace

ie I cant see the Input Field ..Im sendin the code for ur reference.

public static void wdDoModifyView(IPrivateDynUIView wdThis, IPrivateDynUIView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(firstTime) {

//IWDGroup theGroup = (IWDGroup)

//view.getElement("InputGroup");

IWDUIElement uiElement = null;

IWDInputField input = (IWDInputField)view.createElement(IWDInputField.class,"InputField");

input.setValue("xxx");

input.setLength(20);

input.setTooltip("Dynamic Input Field");

input.setVisible(WDVisibility.VISIBLE);

uiElement = input;

// theGroup.addChild(uiElement);

}

//@@end

}

Anything wrong in this Code ?.

I want to Display a Input Field Dynamically.Hw can i get this ? Plz Help me out.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Try this

if(firstTime) {

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

theGroup.createLayout(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDMatrixLayout.class);

theGroup.destroyAllChildren();

IWDUIElement uiElement = null;

IWDInputField input = (IWDInputField)view.createElement(IWDInputField.class,"InputField");

input.setValue("xxx");

input.setLength(20);

input.setTooltip("Dynamic Input Field");

input.setVisible(WDVisibility.VISIBLE);

uiElement = input;

theGroup.addChild(uiElement);

}

Kind Regards

Mukesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Did u add this group to the Root UI element Container

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

trans.addChild( theGroup);

Regards,

Vijayakhanna Raman

former_member189631
Active Contributor
0 Kudos

Hi,

Thank you Yar, I got it.I will reward You, One more query , what is the Diff b/w DropDown By Key and Value ?.

I want to Create a DropDownbOX Hw to add the elements Dynamically ?

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

For data base value storage use DropDown by index.

For Dictionary Simple type use DropDown by Key.

DropDown by Key:Cteate Attribute and bind it

ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("Attribute name binded to UI");

IModifiableSimpleValueSet val=myType.getSVServices().getModifiableSimpleValueSet();

val.put("Key1","Value");

val.put("Key2","Value");

In Domodify

IWDDropDownByKey di=(IWDDropDownByKey )view.createElement(IWDDropDownByKey .class,"dropindex");

di.bindTexts("Attribute name");

DropDown by index:Bind this by node with Attribute

In init method:

//creating node

IWDNodeInfo n= wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,true,false,true,true,null,null,null);

n.addAttribute("name","ddic:com.sap.String");

//getting child node

IWDNode n1= wdContext.getChildNode("DynamicNode",0);

IWDNodeElement nel=n1.createElement();

String s1=new String("hai");

nel.setAttributeValue("name",s1);

n1.addElement(nel);

IWDNodeElement nel1=n1.createElement();

String s2=new String("bye");

nel1.setAttributeValue("name",s2);

n1.addElement(nel1);

In Domodify

IWDDropDownByIndex di=(IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class,"dropindex");

di.bindTexts("DynamicNode.name");

Regards,

Vijayakhanna Raman