cancel
Showing results for 
Search instead for 
Did you mean: 

how to disable the single radio button in radionbuttongroup????

Former Member
0 Kudos

Hi Experts,

  I created the RadiobuttonbyKey UI element and i have set it to the SimpleType which has two values.Say Ex:

    Simple Type : 1 bus

                         2 train

My Requirement is onActionxxxx i have to display only one raiobutton in the Group and onActionyyyy i have to show both the radiobuttons in the group.

Can anyone please help me how to achieve this..............

Regards,

Mahesh


Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

you can manipulate the simple type. in action 1, just put one value to the simple type, in other case, put two value in the simple type.

Former Member
0 Kudos

Can you please tell me how to set the values to the simple type ??

Is their any code to set the simple type values ??

former_member191044
Active Contributor
0 Kudos

Here is an example of what you have to do:

// Access interface ISimpleTypeModifiable for modifying the attribute's datatype

  IWDAttributeInfo attributeInfo =

    wdContext.getNodeInfo().getAttribute(IPrivateMain.IContextElement.COUNTRY);

  ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();

  // Set field label and populate valueset

  countryType.setFieldLabel("Country");

  IModifiableSimpleValueSet valueSet =

  countryType.getSVServices().getModifiableSimpleValueSet();

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

    valueSet.put("Key_"+i,"Country "+i);

  } 

  // initialize context value attribute 'Country'

  wdContext.currentContextElement().setCountry("Key_0");

Hope this helps.

Regards

Tobias

govardan_raj
Contributor
0 Kudos

hi mahesh ,

you can create an attribute in the context , and do svs coding for that in action xxx and actionyyy like shown below .

onactionxxx

{

IWDAttributeInfo radioTypeKeyInfo = wdContext.nodeRadioButton().getNodeInfo().getAttribute(IPublicAxisUtilsComp.IRadionButtonElement.RADIO_BUTTN_ATTR);

   ISimpleTypeModifiable radioKeySimpleTypeModifiable = radioTypeKeyInfo.getModifiableSimpleType();

   IModifiableSimpleValueSet radioKeyvalueset = radioKeySimpleTypeModifiable.getSVServices().getModifiableSimpleValueSet();

   radioKeyvalueset.clear();

   radionkeyvalueset.put("1","Train");

   }

onActionyyyy

{

IWDAttributeInfo radioTypeKeyInfo = wdContext.nodeRadioButton().getNodeInfo().getAttribute(IPublicAxisUtilsComp.IRadionButtonElement.RADIO_BUTTN_ATTR);

   ISimpleTypeModifiable radioKeySimpleTypeModifiable = radioTypeKeyInfo.getModifiableSimpleType();

   IModifiableSimpleValueSet radioKeyvalueset = radioKeySimpleTypeModifiable.getSVServices().getModifiableSimpleValueSet();

   radioKeyvalueset.clear();

   radionkeyvalueset.put("1","Train");

   radionkeyvalueset.put("2","Bus");

make sure that this context node RadionButton is created in the view itself, because you are adding the above code to actions defined in the view .

Regards

Govardan


Former Member
0 Kudos

Hi Govardhan i have done as you suggested but nothing is displaying in the radiobuttongroupindex.

after wrinting the code do i need to add  radioKeyvalueset it to the  node??

govardan_raj
Contributor
0 Kudos

hi Mahesh ,

which UI element you are using ......radio button group is group by key or group by index  ?

if it is group by key above specified code holds ,

if is group by index , then you have bind a node of cardinaility 0...n and with one attiribute in that node.

in onActionxxxx()

   wdcontext.nodeRadioButton().invalidate();

IPrivateDynamicTableView.IRadioButtonElement element;

element = wdContext.createRadioButtonElement();

element.setValueRadioButton("Train");

 

wdContext.nodeRadioButton().addElement(element);

----------------------------------------------------------------------------------------------------

and in onActionyyyyy()

wdcontext.nodeRadioButton().invalidate();

IPrivateDynamicTableView.IRadioButtonElement element;

element = wdContext.createRadioButtonElement();

element.setValueRadioButton("Train");

 

wdContext.nodeRadioButton().addElement(element);

element = wdContext.createRadioButtonElement();

element.setValueRadioButton("Bus");

 

wdContext.nodeRadioButton().addElement(element);

Regards

Govardan Raj

Answers (0)