EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: yogesh on July 17, 2012, 06:04:44 AM



Title: How to disable contextmenu
Post by: yogesh on July 17, 2012, 06:04:44 AM
Hi,

 i want to disable some items in context menu runtime how to achine this using this framework

example


<div id="mm" class="easyui-menu" style="width: 120px;">
        <div  id="mm1" onclick="">
            menu1</div>
             <div  onclick="">
            menu2</div>
        <div onclick="menu3">
           menu3</div>
        <div onclick="menu4">
            menu4</div>
       
    </div>

i want to disable menu 1 and 3 how to achieve this


Title: Re: How to disable contextmenu
Post by: tomhj on July 17, 2012, 10:12:12 AM
Check the documentation for the menu widget.  There is a disableItem() method you can use


Title: Re: How to disable contextmenu
Post by: yogesh on July 17, 2012, 01:58:03 PM
i saw that but i am unable to implement that there is no example of that


Title: Re: How to disable contextmenu
Post by: stworthy on July 17, 2012, 08:29:43 PM
Call 'findItem' method to find the menu item and then call 'disableItem' method to disable that menu item.
Code:
var m1 = $('#mm').menu('findItem','menu1');
$('#mm').menu('disableItem', m1.target);
var m3 = $('#mm').menu('findItem','menu3');
$('#mm').menu('disableItem', m3.target);


Title: Re: How to disable contextmenu
Post by: yogesh on July 18, 2012, 03:47:03 AM
thats gr8 !!!

its working !!
thank you :)