extjs - 如何在单击时显示包含两个单独工作的单选按钮的标题菜单
问题描述
我在标题中创建了这个按钮,它通常显示一个包含两个垂直对齐的单选按钮的菜单。问题是菜单显示,但单选按钮不是独占的,即使我点击另一个按钮仍然检查。我的问题是如何在菜单中正确定义无线电组?
这是我的代码:
Ext.define('Mine.view.headerThemeButton', {
extend: 'Ext.panel.Panel',
xtype: 'headerThemeButton',
width: 50,
height: 58,
padding : 'auto 0 auto 0',
bodyStyle: 'border-color: #FFFFFF !important;',
items: [{
xtype:'button',
height: '100%',
glyph: 'xf142@FontAwesome',
cls :'headerButtonsCls',
listeners: {
click: function(e,target) {
var coords = e.getXY(),
x = parseInt(coords[0]),
y = parseInt(coords[1]),
finalY = y + 50;
Ext.create('Ext.menu.Menu',{
xtype: 'radiogroup',
columns: 1,
fieldLabel: 'Filmed In',
name: 'filmed_in',
items: [{
name: 'filmed_in',
boxLabel: 'Color',
inputValue: 'color'
},{
name: 'filmed_in',
boxLabel: 'Black & White',
inputValue: 'B&W'
}]
}).showAt(x, finalY);
}
}
}]
});
提前致谢
解决方案
在 onClick 创建的菜单中,您将菜单的 xtype 设置为 radiogroup。但是您必须将 radiogroup 添加为项目。
Ext.create('Ext.menu.Menu', {
// you missed this line
items: [{
xtype: 'radiogroup',
items: [
//radiofields
]
}]
}).showAt(x, finalY);
推荐阅读
- python - Django获取登录用户的用户名并将其传递给模型
- ant-media-server - 如何在 Ant Media Server 中使用 HLS 流式传输 VoD 文件?
- c# - 格式化文本框以在运行时以带小数的千位分隔符数字的形式显示用户输入
- javascript - 如何在超测请求中设置认证信息?
- loops - Go 模板中的嵌套循环
- testing - 下载文件在 Cypress 中挂起
- java - 节俭的通信错误不会被 promise reject 或 cath 捕获
- regex - 正则表达式字符串不以正斜杠开始或结束(或两者)
- python - 通过 Looping Python 提取子页面链接
- python - 无法在 Windows 10 上通过“pip”安装任何包,Python 中的 ssl 模块不可用