获取 EXT-GWT RadioGroup 中选定 RadioButton 的名称
我有以下代码:
final Radio trDelRadio = new Radio();
trDelRadio.setName("TDRADIO");
trDelRadio.setBoxLabel("Training");
final Radio cdcRadio = new Radio();
cdcRadio.setName("CDCRADIO");
cdcRadio.setBoxLabel("Content");
final Radio msRadio = new Radio();
msRadio.setName("MSRADIO");
msRadio.setBoxLabel("Management");
final Radio osRadio = new Radio();
osRadio.setName("OSRADIO");
osRadio.setBoxLabel("Outsourcing");
final RadioGroup radioGroup = new RadioGroup();
radioGroup.setOrientation(Orientation.VERTICAL);
radioGroup.add(trDelRadio);
radioGroup.add(cdcRadio);
radioGroup.add(msRadio);
radioGroup.add(osRadio);
radioGroup.addListener(Events.Change, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) {
GWT.log("Service type: " + radioGroup.getValue().getBoxLabel(), null);
}
});
在此代码中,我使用 GXT 2.0.1 创建四个单选按钮,然后将它们组合到单选按钮组中。
Line
GWT.log("Service type: " + radioGroup.getValue().getBoxLabel(), null);
正在检索所选复选框的标签并且工作正常,但是当我尝试获取名称或任何其他信息时,它正在获取 RadioGroup 的值。 我在这里做错了什么? 如何在 RadioGroup 中获取选定的单选按钮?
I have following code:
final Radio trDelRadio = new Radio();
trDelRadio.setName("TDRADIO");
trDelRadio.setBoxLabel("Training");
final Radio cdcRadio = new Radio();
cdcRadio.setName("CDCRADIO");
cdcRadio.setBoxLabel("Content");
final Radio msRadio = new Radio();
msRadio.setName("MSRADIO");
msRadio.setBoxLabel("Management");
final Radio osRadio = new Radio();
osRadio.setName("OSRADIO");
osRadio.setBoxLabel("Outsourcing");
final RadioGroup radioGroup = new RadioGroup();
radioGroup.setOrientation(Orientation.VERTICAL);
radioGroup.add(trDelRadio);
radioGroup.add(cdcRadio);
radioGroup.add(msRadio);
radioGroup.add(osRadio);
radioGroup.addListener(Events.Change, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) {
GWT.log("Service type: " + radioGroup.getValue().getBoxLabel(), null);
}
});
In this code I'm using GXT 2.0.1 create four radio buttons and then combining them into the radio button group.
Line
GWT.log("Service type: " + radioGroup.getValue().getBoxLabel(), null);
is retrieving Label of selected check box and works fine, but when I'm trying to get name or any other information it's getting value of the RadioGroup. What am I doing wrong here? How do I get selected radio button in RadioGroup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用
radio.setValueAttribute(String value)
方法来存储值。I use
radio.setValueAttribute(String value)
method to store value.我想,这就是你需要的。
I think, that's you need.