cancel
Showing results for 
Search instead for 
Did you mean: 

IWDRadioButtonGroupByIndex problem while setting values

Former Member
0 Kudos

Hi All,

I have problem in setting selected values to IWDRadioButtonGroupByIndex and IWDDropDownByIndex while dynamic creation. I have create some nodes on the wdDoInit()method and bind into UIElement in wdDoModifyView() method. I am using the following codes:

In wdDoInit() Method

Node Creation for IWDRadioButtonGroupByIndex

============================================

for(int p1 = 1; p1 <= janeecount; p1++)

{

IWDNodeInfo info=wdContext.getNodeInfo().addChild("NodeAcheck"+p1,null,true,false,true,false,false,true,null,null,null);

info.addAttribute("Name","ddic:com.sap.dictionary.string");

}

Node Creation for IWDDropDownByIndex

====================================

for(int p = 1; p <= multiple; p++)

{

IWDNodeInfo multiplenode = multipleinfo.addChild("Node" + p, null, true, false, true, true, false, true, null, null, null);

multiplenode.addAttribute("roles", "ddic:com.sap.dictionary.string");

}

Load values for IWDDropDownByIndex node

========================================

for(int d = 1; d <= multiple; d++)

while(rs4.next())

{

IWDNode node1 = wdContext.nodeNodeA().getChildNode("Node" + s, IWDNode.NO_SELECTION);

PreparedStatement pst4 = conn.prepareStatement("select * from Z_CV_GENERIC_ANTWOORDEN where cv_generic_vraagno=? and cv_verwijder_markering=0");

pst4.setInt(1, vraagno[s - 1]);

IWDNodeElement elem1;

for(ResultSet rs5 = pst4.executeQuery(); rs5.next(); node1.addElement(elem1))

{

elem1 = node1.createElement();

elem1.setAttributeValue("roles", rs5.getString("cv_antwoord_tekst"));

}

s++;

}

Load values for IWDRadioButtonGroupByIndex node

===============================================

String janee[]=new String[2];

janee[0]="ja";

janee[1]="nee";

for(int t = 1; t <= janeecount; t++){

for(int i=0;i<2;i++){

IWDNodeElement eles=wdContext.getChildNode("NodeAcheck"+t,IWDNode.LEAD_SELECTION).createElement();

eles.setAttributeValue("Name",janee<i>.toString());

wdContext.getChildNode("NodeAcheck"+t,IWDNode.LEAD_SELECTION).addElement(eles);

}

}

In wdDoModifyView() method

Bind node into the IWDRadioButtonGroupByIndex

=============================================

IWDAttributeInfo info=wdContext.getChildNode("NodeAcheck"+janee,IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("Name");

IWDRadioButtonGroupByIndex radioList = (IWDRadioButtonGroupByIndex)view.createElement (IWDRadioButtonGroupByIndex.class, "inpja"+index);

radioList.bindTexts(info);

Bind node into the IWDDropDownByIndex

=====================================

IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)view.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDDropDownByIndex.class, "drop" + index);

dropDownList.bindTexts(info);

In the above code for creation mode it work's fine. But in the Edit mode i have to set some values as selected text for IWDDropDownByIndex and on particular button for IWDRadioButtonGroupByIndex. How can i set these values as selected. Can anybody help?.

Thanks in Advance,

S.V.Selva Bala.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

From here i have concluded that u have more than one RadioButtonGroupByIndex and DropDownByIndex.

Now the lead selection is the value selected. So in order to set a perticular value for DropDown and RadioButton set its lead selection.

wdContext.getChildNode("Node"+i,"IWDNode.LEAD_SELECTION).setLeadSelection(index);

Similarly for all nodes.

Regards,

Piyush.

Former Member
0 Kudos

Hi Piyush,

Thanks for your quick reply. Your concluded is 100% correct. I have created morethan one RadioButtonGroupByIndex and DropDownByIndex.

In update mode for RadioButtonGroupByIndex i have two button, which name is 'ja' and 'nee'. In defalut the 'ja' RadioButtonGroupByIndex is selected, but i have to set 'nee' as selected RadioButtonGroupByIndex.

So as per your suggestion, in update mode i set to setLeadSelection to 0 like this:

wdContext.getChildNode("NodeAcheck" + janee,IWDNode.LEAD_SELECTION).setLeadSelection(0);

But i couldn't get any change, got the same answer. Here i have some questions.

1.What is meaning for the following line?.

wdContext.getChildNode("NodeAcheck" + janee,IWDNode.LEAD_SELECTION).setSelected(2,true);

2. Is there any change for RadioButtonGroupByIndex node creation? In the following line:

IWDNodeInfo info=wdContext.getNodeInfo().addChild("NodeAcheck"+p1,null,true,false,true,false,false,true,null,null,null);

Advance in Thanks,

S.V.Selva Bala.

Former Member
0 Kudos

Hi Piyush,

Thanks lot your reply. I have solved my problem using your suggesstion. I put reward point also to you.

Thanks

S.V.Selva Bala

Answers (0)