extjs如何使用单选按钮创建菜单

extjs how to create menu with radio buttons

本文关键字:创建 菜单 单选按钮 何使用 extjs      更新时间:2023-09-26

我可以创建带有复选框的菜单,如下所示

xtype : 'button',
id : 'resultExportBtn',
ui : 'custombtn',
cls : 'field-margin',
style : 'margin-right:5px',
text : 'Export',
menu : [ 
    {
        text : 'CSV',
        fName : 'csv',
        checked : true,
        xtype : 'menucheckitem'
    }, {
        text : 'PDF',
        fName : 'pdf',
        checked : false,
        xtype : 'menucheckitem'
    }
]

有人知道如何用单选按钮创建菜单吗?

使用放射组xtype代替菜单检查项

menu : [ 
    {
        xtype: 'radiogroup',
        columns: 1,
        vertical: true,
        items: [
            { 
                boxLabel: 'CSV', 
                name: 'rb', 
                inputValue: '1' 
            },
            { 
                boxLabel: 'PDF', 
                name: 'rb', 
                inputValue: '2' 
            }           
        ]
    }
]

查看示例