on 07-27-2006 5:56 AM
Hi,
Can anyone help me to create a DropDownByIndex and CheckBox dynamically in the Implementation tab of a View. Also I am not able to insert values into the dropdown.
If someone send the code it would be very helpful
Thanks
Kalyan
First, you don't need to create the context structure programmatically like the other post suggests. This is only confusing.
Say, you have created a node "Items" (cardinality 0:N, selection 0:1) with an attribute "Text" in NWDS.
To create a DropDownByIndex that displays the elements of node "Items" as its items, you write the following code in method wdDoModifyView():
IWDDropDownByIndex dd = (IWDDropDownByIndex) view.createElement(IWDDropDownByIndex.class, null);
dd.bindTexts("Items.Text");
IWDUIElementContainer parent = (IWDUIElementContainer) view.getElement("ID-of-parent");
parent.addChild(dd);
For a CheckBox, you need a boolean attribute for storing the "checked" state. Works the same way.
To avoid creation of the element on every call of wdDoModifyView(), you should place this code inside an if-statement that guards when to create the element, e.g. if (firstTime).
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Kalyan,
write the code below in wdDoModify()
if(firstTime){
IWDCheckBox icb=(IWDCheckBox)view.createElement(IWDCheckBox.class,null);
IWDDropDownByIndex idbi=(IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class,null);
}
regards,
naga raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create one static node name like 'NodeA'
Create one Node(MultiNode) with one attribute(roles) using the following code. Inside the DoInit() method
Step 1:
IPrivate<ViewName>.INodeAElement ele = wdContext.createNodeAElement();
wdContext.nodeNodeA().addElement(ele);
IWDNodeInfo multipleinfo = wdContext.nodeNodeA().getNodeInfo();
IWDNodeInfo multiplenode = multipleinfo.addChild("MultiNode" , null, true, false, true, true, false, true, null, null, null);
multiplenode.addAttribute("roles", "ddic:com.sap.dictionary.string");
Step 2:
Assign values for Dropdown. Here i assigned 5 values.if you want assign values from database/BAPI also.
IWDNode node1 = wdContext.nodeNodeA().getChildNode("MultiNode", IWDNode.NO_SELECTION);
IWDNodeElement elem1;
for(int s=0;s<5;s++){
elem1 = node1.createElement();
elem1.setAttributeValue("roles","Value"+s);
node1.addElement(elem1);
}
Step 3:
Inside Domodifyview create IWDDropDownByIndex UI Element and Bind it.
IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class, "drop");
IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
dropDownList.bindTexts(info);
Finally add this Dropdown into container. Like this you can create more Dropdown and add action to the dropdown as dynamically.
<b>Valuable answer=points</b>
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.