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

时间:2019-08-19 15:02:09

标签: javascript radio-button sapui5

应该提供.setSelectedButton什么样的值,以便在RadioButtonGroup构造中选择特定的按钮。

我尝试过的事情:

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

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

1 个答案:

答案 0 :(得分:1)

根据文档,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

相关问题