on 2005 Sep 21 12:43 PM
Hello all,
I want to create dynamically a DropDownByKey and bind a list (dynamically) to it.
In standard doInit methods I added the following code :
IWDNodeInfo ddlNode = wdContext.getNodeInfo().addChild("DynamicDDLNode",null,true,true,false,false,false,true,null,null,null);
ddlNode.addAttribute("ddlKey" , "ddic:com.sap.dictionary.string");
ISimpleTypeModifiable myType= ddlNode.getContext().getModifiableTypeOf("DynamicDDLNode");
//ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("DynamicDDLNode");
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
values.put("0","January");
values.put("1","February");
values.put("2","March");
values.put("3","April");
values.put("4","May");
values.put("5","June");
values.put("6","July");
values.put("7","August");
values.put("8","September");
values.put("9","October");
values.put("10","November");
values.put("11","December");
I have got "java.lang.ClassCastException" on
ISimpleTypeModifiable myType= ddlNode.getContext().getModifiableTypeOf("DynamicDDLNode");
I added also the following code to wdDoModifyView method:
IWDTransparentContainer container =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDDropDownByKey theDropDown = (IWDDropDownByKey) view.createElement(IWDDropDownByKey.class,"ddlByKey" );
theDropDown.bindSelectedKey("DynamicNode.ddlKey);
theDropDown.setWidth("4");
theDropDown.setVisible(WDVisibility.VISIBLE);
container.addChild(theDropDown);
Could you please guide me how to create correctly a DropDownByKey at run time ?
Thanks ahead
Hi Yoel,
In your code, instead of
<b>
ddlNode.addAttribute("ddlKey" , "ddic:com.sap.dictionary.string");
ISimpleTypeModifiable myType= ddlNode.getContext().getModifiableTypeOf("DynamicDDLNode");</b>
write
IWDAttributeInfo info = ddlNode.addAttribute("ddlKey" , "ddic:com.sap.dictionary.string");
ISimpleTypeModifiable myType= info.getModifiableSimpleType();
And instead of
<b>theDropDown.bindSelectedKey("DynamicNode.ddlKey);</b>
write
theDropDown.bindSelectedKey("DynamicDDLNode.ddlKey");
Also, increasing the size of the dropdown from "4" would make it properly visible, eg:
theDropDown.setWidth("60");
Best regards,
Nibu.
Message was edited by: Nibu Wilson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.