简体   繁体   English

找出是否在单选按钮组中选择了单选按钮

[英]Finding out wether a Radio Button was Selected in a Radio Button-Group

i work with SapUi5 and i want to know a faster way to check wether/how many buttons where clicked in a Radio Button Group. 我使用SapUi5,我想知道一种更快的方法来检查单选按钮组中是否单击了多少个按钮。

Situation: In the Section there are 3 - RadioGroups with 4 Options pro Group, ie 12 in Total, i have given each Group an ID. 情况:在该部分中,有3个-RadioGroups,其中有4个选项Pro Group,即总共12个,我给每个Group提供了一个ID。

Now in a specific File: the Operation sap.ui.getCore("idOfRadioButtonGroup").getSelected() - does Work and gives out wether a Button was clicked, however in the File that i operate from this Operation seems to now work. 现在在特定的文件中:操作sap.ui.getCore(“ idOfRadioButtonGroup”)。getSelected()-确实可以工作,并且给出了单击按钮的方式,但是在我通过该操作进行操作的文件中,现在看来可以工作了。

There is another possiblity to check wether a button was clicked in one of this 3 Groups: 还可以检查是否在这3个组之一中单击了按钮:

sap.ui.getCore().byId("idFirstRadioGroup").mAggregations.buttons[0-3].mProperties.selected 
//(4 Buttons pro Group)

However i would like to know a different solution 但是我想知道一个不同的解决方案

Expected Results: A possibility to find out if a button from a Radio Group 预期结果:可以确定是否来自广播组的按钮

was clicked. 被点击。 (1 Button/4 can be clicked pro RadioGroup) (可以在RadioGroup中单击1 Button / 4)

Actual Results: Doesn't seem to work to full extend 实际结果:似乎无法充分发挥作用

I guess you are looking for the function " getSelectedButton ". 我猜您正在寻找功能“ getSelectedButton ”。

Returns the selected radio button. 返回选定的单选按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM