Ext.menu.Menu主要配置项表:
items Mixed 有效的菜单项数组
shadow Boolean/String 阴影显示方式,默认true(sides方式),sides,frame,drop
菜单项主要类型表:
Ext.menu.TextItem 文本元素
Ext.menu.Separator 菜单分隔符
Ext.menu.CheckItem 包含选择框的菜单项
菜单组件常用方法表:
addElement() Mixed el 添加Element元素
addItem() Ext.menu.Item item 添加一个已存在的菜单项
addMenuItem() Object config 根据菜单项配置对象,添加菜单项
addSeparator() 添加菜单分隔符
addText() String text 添加一字符串
Ext.create('Ext.menu.Menu',{
id: 'mainMenu',
width:200,
floating: false,
renderTo:Ext.getBody(),
items: [
{
text: 'I like Ext',
checked: true,
checkHandler: onItemCheck
},
{
text: 'Ext for jQuery',
checked: true,
checkHandler: onItemCheck
},
{
text: 'I donated!',
checked:false,
checkHandler: onItemCheck
}, '-', {
text: 'Radio Options',
menu: {
items: [
'Choose a Theme',
{
text: 'AeroGlass',
checked:true,
group:'theme',
checkHandler:onItemCheck
}, {
text: 'VistaBlack',
checked:false,
group:'theme',
checkHandler:onItemCheck
}, {
text:'Gray Theme',
checked:false,
group:'theme',
checkHandler:onItemCheck
}, {
text:'Default Theme',
checked:false,
group:'theme',
checkHandler:onItemCheck
}
]
}
}
]
});
function onItemCheck(item, checked){
Ext.MessageBox.alert('Item Check',checked ? 'checked' : 'unchecked'+item.text, );
}