cancel
Showing results for 
Search instead for 
Did you mean: 

Radio Button!!

Former Member
0 Kudos

Hi,

I have 2 radio buttons in 2 columns of the table say for 'yes' and 'No' options.

Initially both the buttons are not selected.Now I want to select one button from them.

I also want that only one button can be select at a time which means to say that for example if i select 'yes' button then the 'no' button should be unselected and vice versa. One button at a time. Either of them.

Please suggest.

Thanks,

vicky

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vikram,

Probably u will be dioing in the method wdDoModifyView().

set the property of Radio button as selected .

--Venkat

Former Member
0 Kudos

Hi

Use the Follwing Steps

Try This Code and also avoid my own variable and use your

own variable like p1 or janee or t etc.ok

it will be very helpful for you

A )Static Radio Button

You have to set leadselection only for static radio button

like

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

B) Dynamic Radiobutton

Step1

Say p1=1

//Node Creation and assign for Yes/No

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");

Step 2

Say t=1

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);

}

Create Mode

***********

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

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

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

radioList.bindTexts(info);

radioList.setColCount(2);

Regards

Dhinakar J

Former Member
0 Kudos

You cannot use RadioButtonGroupByIndex as table cell editor, that's why I suggested using a CheckBox or DropDownBy{Index, Key} instead.

A solution with 2 columns and RadioButton as cell editor:

Context:

People (node, cardinality=0:N)
-- Name (attribute, string)
-- Gender (attribute, string)

(Gender could also be a DDIC type with value set {"male", "female"}).

Table.DataSource = People
Table.Columns = (ColumnName, ColumnMale, ColumnFemale)

ColumnName.TableCellEditor = TextView
ColumnName.TableCellEditor.Text = People.Name

ColumnMale.TableCellEditor = RadioButton
ColumnMale.TableCellEditor.KeyToSelect = "male"
ColumnMale.TableCellEditor.SelectedKey = People.Gender

ColumnFemale.TableCellEditor = RadioButton
ColumnFemale.TableCellEditor.KeyToSelect = "female"
ColumnFemale.TableCellEditor.SelectedKey = People.Gender

Armin

Former Member
0 Kudos

Hi,

Check the thread I have mentioned below. This will give you a basic idea about what to do.

Regards,

Satyajit.

Former Member
0 Kudos

Why not simply using a checkbox or drop-down list and only one table column?

Armin