单选按钮组 -> 应该赋予什么值 - .setSelected()

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

为了 select RadioButtonGroup 构造中的特定按钮,应该 .setSelectedButton 给出什么样的值。

我尝试了什么:

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

预期结果:It selects this specific Button
实际结果:Error

根据文档,setSelectedButton 的参数是 sap.m.RadioButton 对象本身,因此根据您注册和声明所有内容的方式,它更接近于:

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