EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Vilisag on December 08, 2014, 06:56:35 PM



Title: How to enable or remove menu item in easyui ribbon
Post by: Vilisag on December 08, 2014, 06:56:35 PM
Hi all,
 I use easyui ribbon in my project, but I don't know how to enable or remove menu item in easyui ribbon.
 Please help me, thank for help.


Title: Re: How to enable or remove menu item in easyui ribbon
Post by: jarry on December 08, 2014, 08:20:40 PM
To disable a menu item, set the 'disabled' property to true.
Code:
tools:[{
id:'btn-clipboard',
type:'splitbutton',
name:'paste',
text:'Paste',
iconCls:'icon-paste-large',
iconAlign:'top',
size:'large',
menuItems:[{
name:'paste',
text:'Paste',
disabled:true,
iconCls:'icon-paste'
},{
name:'paste-special',
text:'Paste Special...',
iconCls:'icon-paste'
}]

To enable or disable a menu item programmatically, get the menu object first and then call 'enableItem' or 'disableItem' methods to enable or disable the specified menu item. The code below shows how to enable the 'Paste' menu item.
Code:
var m = $('#btn-clipboard').splitbutton('options').menu;  // get the menu object
var item = m.menu('findItem', 'Paste');  // find the menu item
m.menu('enableItem', item.target);  // enable it


Title: Re: How to enable or remove menu item in easyui ribbon
Post by: Vilisag on December 09, 2014, 01:17:47 AM
Thanks jarry!!


Title: Re: How to enable or remove menu item in easyui ribbon
Post by: Vilisag on May 31, 2015, 06:30:38 PM
Thanks jarry!! Menu item has been disabled but when i clicked item, it stilled call function.