[英]listener for radiobutton
I want to add 3 radiobuttons in a toolbar like this: 我想在工具栏中添加3个单选按钮,如下所示:
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'radiogroup',
width: 500,
fieldLabel: 'Show',
items: [
{
xtype: 'radiofield',
id: 'all',
name: 'show',
boxLabel: 'All vehicles',
checked: true
},
{
xtype: 'radiofield',
id: 'online',
name: 'show',
boxLabel: 'Online vehicles'
},
{
xtype: 'radiofield',
id: 'offline',
name: 'show',
boxLabel: 'Offline vehicles'
}
]
}
]
}
]
I want to use a listener for these buttons. 我想为这些按钮使用一个监听器。 When someone clicks on offline i want to load internals.load({url:internals/offline.json});
当有人点击离线时,我想加载internals.load({url:internals / offline.json});
i just can't get it working. 我就是无法正常工作。 Any advice/help?
有什么建议/帮助吗?
Thanks 谢谢
Try this: 尝试这个:
{
xtype: 'radiogroup',
width: 500,
fieldLabel: 'Show',
items: [
{
xtype: 'radiofield',
id: 'all',
name: 'show',
boxLabel: 'All vehicles',
checked: true,
inputValue: 'all'
},
{
xtype: 'radiofield',
id: 'online',
name: 'show',
boxLabel: 'Online vehicles',
inputValue: 'online'
},
{
xtype: 'radiofield',
id: 'offline',
name: 'show',
boxLabel: 'Offline vehicles',
inputValue: 'offline'
}
],
listeners: {
change: function(field, newValue, oldValue) {
var value = newValue.show;
if (Ext.isArray(value)) {
return;
}
if (value == 'offline') {
// do something
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.