cancel
Showing results for 
Search instead for 
Did you mean: 

Binding sap.m.RadioButton

former_member201620
Participant
0 Kudos

Hi folks,

how do I bind the selected property of sap.m.RadioButtons? I understood that I group them with the groupName property but I'm totally missing sth. like RadioButtonGroup to get the selected key or alike. sap.m.RadioButton does not even provide a key? Could someone give an example?

        <RadioButton groupName="MyGroup" text="Option A" selected="true" />

        <RadioButton groupName="MyGroup" text="Option B" />

Say my model looks like this: { currentOption: "A" } The alternative option would be the char "B". How to map this?

BR
Chris

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Christian,

you must use the property-binding of sap.m.RadioButton using the prperty "selected". Following a codesniplet in Javascript to use in View->createContent".

//multi-modell approachto the mvc of ui5

// the model is called "selectionList" and has a item "currentOptionA"

//radiobutton

  var rdbSelectionParameter = new sap.m.RadioButton({

          id : "idSelectionParameter",

          text: 'Selektionsparameter'});

// bindingh to the model
     rdbSelectionParameter.bindProperty('selected',

                                                                 'selectionList>/currentOptionA');

regards

Andreas