Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Garima on Sep 18, 2008 22:05
open dhtmlx forum
diable dhtmlx menu

HI,

Last time i have posted a question regarding disabling menu my question was following:

Hi,
i am using free style type menu having dhtmlxmenu_alter.css.the following code i have written

<script>

var aMenuBar=new dhtmlXMenuBarObject(document.getElementById('altermenu'),'100%',22,"");
aMenuBar.setGfxPath("Menu/imgs/");
aMenuBar.loadXML("Menu/_menu.xml");
aMenuBar.disableSmartPositioning(true);
aMenuBar.showBar();
aMenuBar.disableItem(document.getElementById('main_Exam'));
</script>

i want to disable the menu item Exam having id 'main_exam'.
but it is not performing by this code.
help

And you suggested a answer using the following code:

Try to call disableItem command after xml loading:

aMenuBar.loadXML("Menu/_menu.xml",function(){
aMenuBar.disableItem(document.getElementById('main_Exam'));
});

And i am using it but still the menu item is notgetting diabled.

Note -> here i am using free style menu and my alter menu css code is:

*******************************************************************************************

/*button text - all levels*/
#altermenu .menuButtonSecond td, .menuButton td, .menuButtondown td, .menuButtonover td {
    cursor:pointer;
}

/*menu text - all levels*/
/*chanhed*/
#altermenu .defaultMenuText{
    font:12px Arial,sans-serif;
    padding-left:10px;
    padding-right:5px;
    text-align:left;
}

#altermenu .buttonTextDisabled{
    font: 11px "Microsoft Sans Serif",Arial;
    padding-left:10px;
    padding-right:5px;
color:Blue;
}



/*menu caption if any*/
#altermenu .menuName
{
    color : Blue;
    font : 11px Arial,sans-serif;
    letter-spacing : 3px;
    padding-left : 10px;
    padding-right : 10px;
}
/*========= BUTTONS ======================*/

/*plain button state - top level*/
#altermenu .menuButton
{
    border : solid 1px #d3f3fe;
}

/*down button state - top level*/
#altermenu .menuButtondown {
    background-color : #6495ed;
    border-bottom : solid 1px #FFFFFF;
    border-left : solid 1px #808080;
    border-right : solid 1px #FFFFFF;
    border-top : solid 1px #808080;
    cursor : pointer;
    
}
/*mouse over button state - top level*/
/* mouse over color for menu */
#altermenu .menuButtonover {
    background-color : #6495ed;
    border-bottom : solid 1px #808080;
    border-left : solid 1px #FFFFFF;
    border-right : solid 1px #808080;
    border-top : solid 1px #FFFFFF;
    cursor : pointer;
}
/*plain button state - other levels*/
#altermenu .menuButtonSecond {
    background-color:#d3f3fe;
    border : solid 1px #d3f3fe;
    font:12px Arial,sans-serif;
}
/*mouse over button and down button states - other levels*/
#altermenu .menuButtonSeconddown,#altermenu .menuButtonSecondover {
    border : solid 1px #d3f3fe;
    font:12px Arial,sans-serif;
    background-color : #6495ed;
    color:navy;
    cursor : pointer;
}
/*icon place style on button over/down - other levels
.menuButtonSeconddownimg {
    background-color : #C9D9F5;
}*/

/*text of mouse over button - other levels*/
#altermenu .menuButtonSeconddown td {
     color:navy;
     cursor:pointer;
     border:0px solid;
}


/*============ PANELS and DEVIDERS ===========================================*/

/*manu panel - top level*/
/* Here to change the background color of menu */
#altermenu .menuTable{
    background-color : #d3f3fe;
    border: solid #6495ed 1px;
    margin : 0px;
    -moz-user-select : none;
    padding : 0px;
    
}
/*menu panel - other levels*/
#altermenu .secondMenuTable{
    background-color : #d3f3fe;
    border: solid #6495ed 1px;
    margin : 2px;
    -moz-user-select : none;
    padding : 0px 1px 0px 2px;
}


#altermenu .menuDivider {
    background-color : #d3f3fe;
    border : solid #6495ed 1px;
    height : 100%;
    margin-bottom : 2px;
    margin-top : 1px;
    overflow : hidden;
    vertical-align : middle;
    width : 2px;
}



/*devider - horizontal*/
#altermenu .menuDividerY {
    background-color : #6495ed ;
    border-bottom : solid #FFFFFF 1px;
    border-top : thin #6495ed 1px;
    height : 1px;
    overflow : hidden;
    width : 100%;
}

/*================== DRAG HANDLERS ==================*/

/*drag handler for menu - horizontal*/
#altermenu .menuHandle {
    background-color : #6495ed;
    border-bottom : solid #d3f3fe 1px;
    border-left : solid #FFFFFF 1px;
    border-right : solid #d3f3fe 1px;
    border-top : solid #FFFFFF 1px;
    cursor : move;
    height : 100%;
    overflow : hidden;
    width : 3px;
}

/*drag handler for menu - vertical*/
#altermenu .vmenuHandle {
    background-color : #6495ed ;
    border-bottom : solid #d3f3fe 1px;
    border-left : solid #FFFFFF 1px;
    border-right : solid #d3f3fe 1px;
    border-top : solid #FFFFFF 1px;
    cursor : move;
    height : 3px;
}
/*text color for pressed and over items - top level*/
#altermenu .menuButtondown .defaultMenuText,#altermenu .menuButtonover .defaultMenuText{
    color:white;
}

/*text color for pressed and over items - top level*/
#altermenu .menuButtonSeconddown .defaultMenuText,#altermenu .menuButtonSecondover .defaultMenuText{
    color:white;
}


/*============ ICONS and SCROLLERS ====================*/

/*disabled icon - all levels*/
#altermenu .iconGray {
    filter : BlendTrans(Percent=50) gray();
    cursor: pointer;
    border:solid 1px #D4D0C8;
}

/*enabled scroller*/
#altermenu .menuScrollerEnabled{
    background-color:#CAC8D4;
     cursor: pointer;    
     text-align:center;
}
/*disabled scroller*/
#altermenu .menuScrollerDisabled{
    background-color: #CAC8D4;
    cursor: pointer;
    visibility:hidden;
    text-align:center;
}

*************************************************************************************************

Please suggest what can i do because it is urgent.
Answer posted by Support on Sep 22, 2008 01:22
Sorry, there was my typo.  The correct approach is:

aMenuBar.loadXML("Menu/_menu.xml",function(){
aMenuBar.disableItem('main_Exam');
}); 

You need to pass item's id to the disableItem.