Roman11222
Roman11222

Reputation: 43

Radio Button Group -> what value should it be given to - .setSelected()

What kind of value should .setSelectedButton be given in order to select a specific Button within a RadioButtonGroup Construct.

What I tried:

sap.ui.getCore().byId("RadioButtonGroup").setSelectedButton("idOftheButton")

Expected Result: It selects this specific Button
Actual Result: Error

Upvotes: 0

Views: 837

Answers (1)

Jorg
Jorg

Reputation: 7250

According to the documentation, the parameter for setSelectedButton is the sap.m.RadioButton object itself, so depending on how you register and declare everything it's something closer to:

var button = sap.ui.getCore().byId("idOftheButton"); //find the button
sap.ui.getCore().byId("RadioButtonGroup").setSelectedButton(button);

https://sapui5.netweaver.ondemand.com/sdk#/api/sap.m.RadioButtonGroup/methods/setSelectedButton

Upvotes: 1

Related Questions