[ 2 posts ]

RudyCox

  • Username: psxtekno
  • Joined: Mon Sep 26, 2011 5:06 am
  • Posts: 4
  • Offline
  • Profile
Tags:

menubar - set menuitem to 'disabled'

Post Posted: Mon May 14, 2012 9:23 am
+0-
Hi, how can set a menubar item to 'disabled' after it has been rendered?

myitem is ....
<li class="yuimenuitem"><a class="yuimenuitemlabel" onclick="" id="myitem">MYTEXT</a></li>

I tried:
1) mymenubar.getMenuItem('myitem').cfg.setProperty("disabled", true);
2) YAHOO.widget.MenuManager.getMenu('myMenubar').getMenuItem('myitem').cfg.setProperty("disabled", true);

but nothing works

thankyou in advance for any answer

Rudy

RudyCox

  • Username: psxtekno
  • Joined: Mon Sep 26, 2011 5:06 am
  • Posts: 4
  • Offline
  • Profile

Re: menubar - set menuitem to 'disabled'

Post Posted: Mon Jun 11, 2012 6:26 am
+0-
I'll answer by myself, maybe useful to someone

I have 4 different menu instance in my page whose items come from database. I don't know at what index a specific menuItem will be, but I need to enable/disable some of them.
so first of all add a global var for then menu Manger
Code:
var menuM=YAHOO.widget.MenuManager;


in the function that create and render the/each menu like
Code:
xMenu = new YAHOO.widget.MenuBar("mainmenu",........
...
xMenu.render();


add the menu to the ManuMenager
Code:
menuM.addMenu('mainmenu');
...
menuM.addMenu('menuazioni');
 



from now you can access each menuitem in any menu using its Id.
For instance, to disable the menuitem "eseguito" in a menu like that

Code:
<div id="menuazioni" class="yuimenu">
    <div class="bd">
        <ul class="first-of-type">
            <li class="yuimenuitem" id="eseguito"><a class="yuimenuitemlabel" href="javascript:azione='3';esegui();" >ESEGUITO</a></li>......


simply use

Code:
Event.onContentReady("eseguito", function(){
menuM.getMenuItem('eseguito').cfg.setProperty("disabled", true);
 });   
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum