on 04-28-2008 10:48 AM
Dear All,
How can I create dynamic dropdown boxes?
When I select a tab, It will generate dropdown boxes dynamically.When I select one option in that dropdown box, once again it has to generate one more dropdown box.
Values for these dropdown boxes are coming from RFCs
Thanks
Rajani
Try this code:-
Create a static node in the componenet controller and map with the views and set the cardinality to 1..n.(say static node is-->calculation_col)
theDropDownCalc = (IWDDropDownByKey) view.createElement(IWDDropDownByKey.class, null);
secondAttInfo.addAttribute("write the any dynamic attribute name<say XXX>","<the datatype say string/boolean/integet>");
theDropDownCalc.bindSelectedKey("calculation_col.<the name of the static node created above>"+""XXX);
theTabContainer1.addChild(theDropDownCalc);//Add the child to teh containier
wdContext.nodeCalculation_col().currentCalculation_colElement().setAttributeValue(XXX<attribute name>,"Blank");//Set teh default value as blank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First, it does not matter where the data for the drop-down lists come from. From the view of a drop-down list, they come from the view controller context.
Next, it depends on how dynamic this must be. Is the number of drop-down lists fixed, but you just want to make the content and state dependend from the selection of another drop-down list, or do you need an arbitraty deep cascade of drop-down lists?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for reply
I strucked at the context binding itself.
I created dropdownByIndex dynamically.For this values are coming form rfc.
wdThis.wdGetDynamicMenuCompController().executeZsd_Fm_Land_Input();
IWDDropDownByIndex couDrop=(IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class,"countrydrop");
couDrop.bindTexts(wdContext.currentT_LandElement().getLandx());
theActionContainer.addChild(couDrop);
I have to bind this dropdown with the landx attribute.
How can I bind?
Rajani
Hi,
To bind to the attribute use as follows
wdThis.wdGetDynamicMenuCompController().executeZsd_Fm_Land_Input();
IWDDropDownByIndex couDrop=(IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class,"countrydrop");
IWDAttributeInfo attrInfo = wdContext.node_Land().getNodeInfo().getAttribute("landx");
couDrop.bindTexts(attrInfo);
theActionContainer.addChild(couDrop);
Hi
You can generate any number of DD with same logic Take a context attr again of type boolean and set to True in the OnSelectAction of the DropDown,
Get this boolean value in wdModifyMethod
if its true create one more DD box.
Regards
Kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Kalyan,
But, using RFCs how can I?
I am using DropDownByIndex
wdThis.wdGetDynamicMenuCompController().executeZsd_Fm_State_Input();
String coubind=wdContext.currentT_LandElement().getLand1();
IWDDropDownByIndex couDrop=(IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class,"countrydrop");
couDrop.bindTexts(coubind);
I got the following exception,
com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicMenuView): unknown child node AF
at com.sap.tc.webdynpro.progmodel.context.Paths.followMetaPath(Paths.java:794)
at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:234)
I have to bind with the land1 which is under T_Land node.
Thanks
Rajani
hi,
Are u sure u have binded the correct response node to the DropDownByKey(please check it).
its better that u excecute the model in the Doinit method of the controller . and do the model context mapping between the view and the Controller.
Bind the text property of the Drop down withe Correct output Model node and Attribute .
Thanks and regards
Fistae
Hi Rajani
Take a context attr of boolean and set this value to true in the OnSelect action of the tab.Because dynamically you can create the elements in wdDoModify method only.
In wdDoModify method get the boolean value of the context attr
like boolean tabSele = wdContext.currentContextElement().get<ContextAttr>();
if( tabSele )
{
IWDTransparentContainer cont =(IWDTransparentContainer )view.getElement(" pass the id of the container")
IWDDropDownByKey dd = view.createElement(IWDDropDownByKey.class,"DD_ID");
//add this to container
cont.addElement(dd);
//populate the values coming from RFC
}
Regards
Kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.